最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

在CentOS7系統(tǒng)上編譯安裝MySQL 5.7.13步驟詳解

 更新時(shí)間:2017年01月23日 09:46:07   作者:技術(shù)學(xué)習(xí)  
本篇文章主要介紹了在CentOS7系統(tǒng)上編譯安裝MySQL 5.7.13步驟詳解,具有一定的參考價(jià)值,有興趣的可以了解一下。

MySQL 5.7主要特性

1、更好的性能

對(duì)于多核CPU、固態(tài)硬盤(pán)、鎖有著更好的優(yōu)化,每秒100W QPS已不再是MySQL的追求,下個(gè)版本能否上200W QPS才是用戶(hù)更關(guān)心的。

2、更好的InnoDB存儲(chǔ)引擎

3、更為健壯的復(fù)制功能

復(fù)制帶來(lái)了數(shù)據(jù)完全不丟失的方案,傳統(tǒng)金融客戶(hù)也可以選擇使用。此外,GTID在線(xiàn)平滑升級(jí)也變得可能。

4、更好的優(yōu)化器

優(yōu)化器代碼重構(gòu)的意義將在這個(gè)版本及以后的版本中帶來(lái)巨大的改進(jìn),Oracle官方正在解決MySQL之前最大的難題。

5、原生JSON類(lèi)型的支持

6、更好的地理信息服務(wù)支持

InnoDB原生支持地理位置類(lèi)型,支持GeoJSON,GeoHash特性
7、新增sys庫(kù)

以后這會(huì)是DBA訪(fǎng)問(wèn)最頻繁的庫(kù)MySQL 5.7已經(jīng)作為數(shù)據(jù)庫(kù)可選項(xiàng)添加到《OneinStack》

安裝準(zhǔn)備

安裝依賴(lài)包

[root@snails ~]# yum -y install gcc gcc-c++ ncurses ncurses-devel cmake bison

下載相應(yīng)源碼包

[root@snails ~]# wget https://sourceforge.net/projects/boost/files/boost/1.59.0/boost_1_59_0.tar.gz
[root@snails ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.7/mysql-5.7.13.tar.gz

新建MySQL用戶(hù)和用戶(hù)組

[root@snails ~]# groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql

預(yù)編譯

[root@snails ~]# tar -zxvf boost_1_59_0.tar.gz
[root@snails data]# md5sum mysql-5.7.13.tar.gz 
8fab75dbcafcd1374d07796bff88ae00 mysql-5.7.13.tar.gz
[root@snails ~]# tar -zxvf mysql-5.7.13.tar.gz
[root@snails data]# mkdir -p /data/mysql
[root@snails data]# cd mysql-5.7.13
[root@snails data]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/data/mysql \
-DWITH_BOOST=../boost_1_59_0 \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DENABLE_DTRACE=0 \
-DDEFAULT_CHARSET=utf8mb4 \
-DDEFAULT_COLLATION=utf8mb4_general_ci \
-DWITH_EMBEDDED_SERVER=1

編譯安裝

[root@snails mysql-5.7.13]# make -j `grep processor /proc/cpuinfo | wc -l`
#編譯很消耗系統(tǒng)資源,小內(nèi)存可能編譯通不過(guò)make install
[root@snails mysql-5.7.13]# make install

設(shè)置啟動(dòng)腳本,開(kāi)機(jī)自啟動(dòng)

[root@snails mysql-5.7.13]# ls -lrt /usr/local/mysql
[root@snails mysql-5.7.13]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@snails mysql-5.7.13]# chmod +x /etc/init.d/mysqld
[root@snails mysql-5.7.13]# systemctl enable mysqld
mysqld.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig mysqld on

配置文件

/etc/my.cnf,僅供參考

[root@snails mysql-5.7.13]# cat > /etc/my.cnf << EOF
[client]
port = 3306
socket = /dev/shm/mysql.sock
[mysqld]
port = 3306
socket = /dev/shm/mysql.sock
basedir = /usr/local/mysql
datadir = /data/mysql
pid-file = /data/mysql/mysql.pid
user = mysql
bind-address = 0.0.0.0
server-id = 1
init-connect = 'SET NAMES utf8mb4'
character-set-server = utf8mb4
#skip-name-resolve
#skip-networking
back_log = 300
max_connections = 1000
max_connect_errors = 6000
open_files_limit = 65535
table_open_cache = 128
max_allowed_packet = 4M
binlog_cache_size = 1M
max_heap_table_size = 8M
tmp_table_size = 16M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
join_buffer_size = 8M
key_buffer_size = 4M
thread_cache_size = 8
query_cache_type = 1
query_cache_size = 8M
query_cache_limit = 2M
ft_min_word_len = 4
log_bin = mysql-bin
binlog_format = mixed
expire_logs_days = 30
log_error = /data/mysql/mysql-error.log
slow_query_log = 1
long_query_time = 1
slow_query_log_file = /data/mysql/mysql-slow.log
performance_schema = 0
explicit_defaults_for_timestamp
#lower_case_table_names = 1
skip-external-locking
default_storage_engine = InnoDB
#default-storage-engine = MyISAM
innodb_file_per_table = 1
innodb_open_files = 500
innodb_buffer_pool_size = 64M
innodb_write_io_threads = 4
innodb_read_io_threads = 4
innodb_thread_concurrency = 0
innodb_purge_threads = 1
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 2M
innodb_log_file_size = 32M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
bulk_insert_buffer_size = 8M
myisam_sort_buffer_size = 8M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
interactive_timeout = 28800
wait_timeout = 28800
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
key_buffer_size = 8M
sort_buffer_size = 8M
read_buffer = 4M
write_buffer = 4M
EOF

添加mysql的環(huán)境變量

復(fù)制代碼 代碼如下:

[root@snails mysql-5.7.13]# echo -e '\n\nexport PATH=/usr/local/mysql/bin:$PATH\n' >> /etc/profile && source /etc/profile

初始化數(shù)據(jù)庫(kù)

復(fù)制代碼 代碼如下:

[root@snails mysql-5.7.13]# mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql

注:

  • MySQL之前版本mysql_install_db是在mysql_basedir/script下
  • MySQL 5.7直接放在了mysql_install_db/bin目錄下。
  • "–initialize"已廢棄,生成一個(gè)隨機(jī)密碼(~/.mysql_secret)
  • "–initialize-insecure"不會(huì)生成密碼
  • "–datadir"目錄下不能有數(shù)據(jù)文件

啟動(dòng)數(shù)據(jù)庫(kù)

[root@snails mysql-5.7.13]# systemctl start mysqld
[root@snails mysql-5.7.13]# systemctl status mysqld
 mysqld.service - LSB: start and stop MySQL
 Loaded: loaded (/etc/rc.d/init.d/mysqld)
 Active: active (running) since 一 2016-07-18 11:15:35 CST; 8s ago
  Docs: man:systemd-sysv-generator(8)
 Process: 23927 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
 CGroup: /system.slice/mysqld.service
   ├─23940 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysql.pid
   └─24776 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql-err...

7月 18 11:15:32 snails systemd[1]: Starting LSB: start and stop MySQL...
7月 18 11:15:35 snails mysqld[23927]: Starting MySQL..[ OK ]
7月 18 11:15:35 snails systemd[1]: Started LSB: start and stop MySQL.

查看MySQL服務(wù)進(jìn)程和端口

[root@snails mysql-5.7.13]# ps -ef | grep mysql
root  23940  1 0 11:15 ?  00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/mysql.pid
mysql 24776 23940 0 11:15 ?  00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql-error.log --open-files-limit=65535 --pid-file=/data/mysql/mysql.pid --socket=/dev/shm/mysql.sock --port=3306
[root@snails mysql-5.7.13]# netstat -tunpl | grep 3306
tcp  0  0 0.0.0.0:3306   0.0.0.0:*    LISTEN  24776/mysqld

設(shè)置數(shù)據(jù)庫(kù)root用戶(hù)密碼

MySQL和Oracle數(shù)據(jù)庫(kù)一樣,數(shù)據(jù)庫(kù)也默認(rèn)自帶了一個(gè) root 用戶(hù)(這個(gè)和當(dāng)前Linux主機(jī)上的root用戶(hù)是完全不搭邊的),我們?cè)谠O(shè)置好MySQL數(shù)據(jù)庫(kù)的安全配置后初始化root用戶(hù)的密碼。配制過(guò)程中,一路輸入 y 就行了。這里只說(shuō)明下MySQL5.7.13版本中,用戶(hù)密碼策略分成低級(jí) LOW 、中等 MEDIUM 和超強(qiáng) STRONG 三種,推薦使用中等 MEDIUM 級(jí)別!

[root@snails mysql-5.7.13]# mysql_secure_installation

常用操作

將MySQL數(shù)據(jù)庫(kù)的動(dòng)態(tài)鏈接庫(kù)共享至系統(tǒng)鏈接庫(kù)

一般MySQL數(shù)據(jù)庫(kù)還會(huì)被類(lèi)似于PHP等服務(wù)調(diào)用,所以我們需要將MySQL編譯后的lib庫(kù)文件添加至當(dāng)前Linux主機(jī)鏈接庫(kù) /etc/ld.so.conf.d/下,這樣MySQL服務(wù)就可以被其它服務(wù)調(diào)用了。

 [root@snails mysql-5.7.13]# ldconfig |grep mysql
[root@snails mysql-5.7.13]# echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf
[root@snails mysql-5.7.13]# ldconfig
[root@snails mysql-5.7.13]# ldconfig -v |grep mysql
ldconfig: 無(wú)法對(duì) /libx32 進(jìn)行 stat 操作: 沒(méi)有那個(gè)文件或目錄
ldconfig: 多次給出路徑“/usr/lib”
ldconfig: 多次給出路徑“/usr/lib64”
ldconfig: 無(wú)法對(duì) /usr/libx32 進(jìn)行 stat 操作: 沒(méi)有那個(gè)文件或目錄
/usr/lib64/mysql:
 libmysqlclient.so.18 -> libmysqlclient.so.18.0.0
/usr/local/mysql/lib:
 libmysqlclient.so.20 -> libmysqlclient.so.20.3.0

創(chuàng)建其它MySQL數(shù)據(jù)庫(kù)用戶(hù)

[root@snails mysql-5.7.13]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.13-log Source distribution

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
mysql>CREATE DATABASE `tonnydb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.01 sec)
mysql> show databases;
+--------------------+
| Database   |
+--------------------+
| information_schema |
| mysql    |
| performance_schema |
| sys    |
| tonnydb   |
+--------------------+
5 rows in set (0.00 sec)
mysql> grant all privileges on tonnydb.* to 'tonny@%' identified by 'Hi.Tonny@888';
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • CentOS 6.8 NFS 文件共享設(shè)置的方法

    CentOS 6.8 NFS 文件共享設(shè)置的方法

    這篇文章主要介紹了CentOS 6.8 NFS 文件共享設(shè)置的方法,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-01-01
  • Linux命令之mkdir,cat,touch,vi/vim的詳解

    Linux命令之mkdir,cat,touch,vi/vim的詳解

    這篇文章主要介紹了Linux命令之mkdir,cat,touch,vi/vim的內(nèi)容,文章內(nèi)容很詳細(xì),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2023-01-01
  • linux系統(tǒng)下如何掛載NTFS移動(dòng)硬盤(pán)

    linux系統(tǒng)下如何掛載NTFS移動(dòng)硬盤(pán)

    用命令行掛載移動(dòng)硬盤(pán)是Linux的基本操作之一,雖然目前有些Linux系統(tǒng)能自動(dòng)加載移動(dòng)硬盤(pán),但有些時(shí)候(比如使用Ubuntu Server或其它Linux系統(tǒng)的時(shí)候)仍然需要手動(dòng)操作,下面這篇文章主要介紹了linux系統(tǒng)下如何掛載NTFS移動(dòng)硬盤(pán),需要的朋友可以參考借鑒。
    2017-01-01
  • linux搭建squid代理服務(wù)器的完整步驟

    linux搭建squid代理服務(wù)器的完整步驟

    這篇文章主要給大家介紹了關(guān)于linux搭建squid代理服務(wù)器的完整步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用linux具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • Linux netstat命令大全詳解

    Linux netstat命令大全詳解

    本篇文章主要介紹了Linux netstat命令詳解,現(xiàn)在分享給大家,也留給日后一個(gè)參考,有需要的可以了解一下。
    2016-11-11
  • linux_HDFS節(jié)點(diǎn)缺失問(wèn)題及解析

    linux_HDFS節(jié)點(diǎn)缺失問(wèn)題及解析

    這篇文章主要介紹了linux_HDFS節(jié)點(diǎn)缺失問(wèn)題及解析,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • linux top下的 minerd 木馬清除方法

    linux top下的 minerd 木馬清除方法

    下面小編就為大家?guī)?lái)一篇linux top下的 minerd 木馬清除方法。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2016-12-12
  • 關(guān)于linux服務(wù)器下vsftpd的一些問(wèn)題

    關(guān)于linux服務(wù)器下vsftpd的一些問(wèn)題

    針對(duì)我自己本身出現(xiàn)的問(wèn)題,將高人與我的QQ聊天記錄整理了一份,然后再加上實(shí)際的操作.終于讓我大徹大悟.現(xiàn)在與大家狠狠的分享這位高人的成果.
    2010-06-06
  • 如何利用watch幫你重復(fù)執(zhí)行命令

    如何利用watch幫你重復(fù)執(zhí)行命令

    這篇文章主要給大家介紹了關(guān)于如何利用watch幫你重復(fù)執(zhí)行命令的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用linux系統(tǒng)具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-05-05
  • centos7安裝部署gitlab服務(wù)器的方法

    centos7安裝部署gitlab服務(wù)器的方法

    這篇文章主要介紹了centos7系統(tǒng)中安裝部署gitlab服務(wù)器的方法,需要的朋友可以參考下
    2021-07-07

最新評(píng)論

鱼台县| 芜湖县| 五莲县| 阿拉善左旗| 临潭县| 建湖县| 万载县| 洛南县| 虎林市| 阜阳市| 高要市| 隆昌县| 府谷县| 丹寨县| 峨眉山市| 星子县| 菏泽市| 宾阳县| 电白县| 曲水县| 阆中市| 闽侯县| 南京市| 藁城市| 清水县| 江川县| 广水市| 镇江市| 仁布县| 南京市| 水富县| 温州市| 册亨县| 博罗县| 苍南县| 锦屏县| 娄烦县| 于田县| 黎城县| 揭西县| 乌兰浩特市|