本篇內容主要講解“5.7.17版本的安裝步驟”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強。下面就讓小編來(lái)帶大家學(xué)習“MYSQL5.7.17版本的安裝步驟”吧!
MYSQL 5.7.17 安裝:
軟件獲?。?
官網(wǎng)下載mysql-advanced-5.7.17-linux-glibc2.5-x86_64.tar.gz
解壓安裝:
解壓mysql-advanced-5.7.17-linux-glibc2.5-x86_64.tar.gz
tar -xvzf mysql-advanced-5.7.17-linux-glibc2.5-x86_64.tar.gz
將解壓的安裝文件拷貝到安裝目錄(可自定義)
[root@VMOS01 mysql]# cp -r mysql-advanced-5.7.17-linux-glibc2.5-x86_64 /usr/local/
[root@VMOS01 mysql]# cd /usr/local
[root@VMOS01 local]# mv mysql-advanced-5.7.17-linux-glibc2.5-x86_64 mysql-5.7.17
建立軟鏈接:
[root@VMOS01 local]# ln -s mysql-5.7.17 mysql
[root@VMOS01 local]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
添加MYSQL 運行用戶(hù):
[root@VMOS01 local]# useradd -r -M -u 496 -s /sbin/nologin mysql
將軟件、目錄賦權給運行用戶(hù)mysql:
[root@VMOS01 local]# chown -R mysql.mysql /usr/local/mysql-5.7.17/
[root@VMOS01 local]# chown -R mysql.mysql /usr/local/mysql
[root@VMOS01 local]# chgrp -R mysql /usr/local/mysql-5.7.17/
初始化mysql db:
[root@VMOS01 local]# cd /usr/local/mysql
[root@VMOS01 bin]# cd ..
[root@VMOS01 mysql]# ./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
2017-04-09 22:38:11 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize
2017-04-09 22:38:20 [WARNING] The bootstrap log isn't empty:
2017-04-09 22:38:20 [WARNING] 2017-04-10T05:38:12.530858Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead
mysql5.7新特性:由上面可以看出, mysql_install_db 已經(jīng)不再推薦使用了,建議改成 mysqld --initialize 完成實(shí)例初始化。
[root@VMOS01 mysql]# ./bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --initialize
2017-04-10T06:12:09.706181Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-04-10T06:12:11.269373Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-04-10T06:12:11.496771Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-04-10T06:12:11.564642Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a27f16b1-1db4-11e7-b5f3-000c2993673d.
2017-04-10T06:12:11.566539Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-04-10T06:12:12.196832Z 0 [Warning] CA certificate ca.pem is self signed.
2017-04-10T06:12:12.439938Z 1 [Note] A temporary password is generated for root@localhost: S8t6ikvw<t1E 【記住初始密碼】
啟動(dòng)mysql:
[root@VMOS01 support-files]# ./mysql.server start
Starting MySQL SUCCESS!
***
將mysql添加到系統服務(wù)管理:
[root@VMOS01 support-files]# cp -v mysql.server /etc/init.d
`mysql.server' -> `/etc/init.d/mysql.server'
[root@VMOS01 support-files]# cd /etc/init.d
[root@VMOS01 init.d]# chkconfig --add mysql.server
[root@VMOS01 init.d]# service mysql.server status
SUCCESS! MySQL running (33215)
[root@VMOS01 init.d]# service mysql.server stop
Shutting down MySQL.. SUCCESS!
[root@VMOS01 init.d]# service mysql.server start
Starting MySQL. SUCCESS!
注意點(diǎn):
編輯my.cnf 讓本地命令行登陸管理mysql, 不會(huì )提示找不到mysql.sock文件錯誤:
[root@VMOS01 mysql]# more /etc/my.cnf
[client]
socket=/var/lib/mysql/mysql.sock
[root@VMOS01 init.d]# mysql -uroot -p
Enter password: 【輸入初始DB的密碼】
**************************
需要更改root@localhost初始密碼:
第一次登陸mysql,需要更改root@localhost密碼,否則會(huì )出現如下錯誤:
[root@VMOS01 support-files]# mysql -ur0ot -p
Enter password:
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user root@localhost identified by "Root15()";
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
至此mysql 5.7.17安裝完成。
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。
Copyright ? 2009-2022 56dr.com. All Rights Reserved. 特網(wǎng)科技 特網(wǎng)云 版權所有 特網(wǎng)科技 粵ICP備16109289號
域名注冊服務(wù)機構:阿里云計算有限公司(萬(wàn)網(wǎng)) 域名服務(wù)機構:煙臺帝思普網(wǎng)絡(luò )科技有限公司(DNSPod) CDN服務(wù):阿里云計算有限公司 百度云 中國互聯(lián)網(wǎng)舉報中心 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證B2
建議您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流瀏覽器瀏覽本網(wǎng)站