CentOS6.6下解壓安裝mysql-5.7.10-linux-glibc2.5-i686.tar.gz

mysql-5.7.10-linux-glibc2.5-i686.tar.gz是目前最新版,二進制發(fā)布包,適合各種32為版本的發(fā)型版Linux,由于只有一個包,解壓后配配就行,很方便,比較符合我的風格。

環(huán)境:centos6.6 x86

1、下載http://dev.mysql.com/downloads/mysql/

http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.10-linux-glibc2.5-i686.tar.gz

迅雷下載后ftp傳到Linux下面/usr/local/soft/

2、解壓縮到/usr/local/下面,mysql的主目錄命名為mysql

[root@localhost local]# cd /usr/local/soft/

[root@localhost soft]# tar zvxf mysql-5.7.10-linux-glibc2.5-i686.tar.gz -C /usr/local

[root@localhost soft]# cd ..

[root@localhost local]# mv mysql-5.7.10-linux-glibc2.5-i686/ mysql

3、在mysql下面創(chuàng)建data數(shù)據(jù)庫文件目錄

[root@localhost local]# mkdir mysql/data

4、創(chuàng)建mysql的用戶組和用戶,并對mysql目錄設置用戶組和用戶

[root@localhost?local]# groupadd mysql

[root@localhost?local]# useradd mysql -g mysql

[root@localhost local]# cd mysql

[root@localhost mysql]# pwd

/usr/local/mysql

[root@localhost mysql]# chown -R mysql .

[root@localhost mysql]# chgrp -R mysql .

5、初始化mysql并啟動mysql服務

[root@localhost mysql]#?cd /usr/local/mysql/bin

[root@localhost bin]#?yum install libaio

./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data已加載插件:fastestmirror, refresh-packagekit, security

設置安裝進程

Loading mirror speeds from cached hostfile

?* base: mirrors.opencas.cn

?* extras: mirrors.btte.net

?* updates: mirrors.btte.net

包 libaio-0.3.107-10.el6.i686 已安裝并且是最新版本

無須任何處理

[root@localhost bin]#?./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data

2016-01-09 12:00:28 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize

2016-01-09 12:00:33 [WARNING] The bootstrap log isn't empty:

2016-01-09 12:00:33 [WARNING] 2016-01-09T04:00:29.262989Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead

2016-01-09T04:00:29.264643Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)

2016-01-09T04:00:29.264653Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

[root@localhost bin]#?cd /usr/local/mysql/support-files

[root@localhost support-files]#?./mysql.server start

Starting MySQL. SUCCESS!?

6、登錄mysql,此版本最新版不許空密碼登錄,實際上有個初始化密碼保存在/root/.mysql_secret這個文件里面,用這個密碼第一次登錄后,再修改密碼。因此先cat查看下初始化密碼(隨機的,每次安裝看到的密碼都不一樣):

[root@localhost ~]#?cat /root/.mysql_secret

# Password set for user 'root@localhost' at 2016-01-09 12:00:28?

:5ul#H6dmcwX

利用初始化密碼:5ul#H6dmcwX開始登錄mysql:

[root@localhost ~]#?cd /usr/local/mysql/bin

[root@localhost bin]#?./mysql -uroot -p:5ul#H6dmcwX

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. ?Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.7.10

Copyright (c) 2000, 2015, 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>

顯示登錄成功,可以執(zhí)行mysql命令操作了!

7、改mysql的root密碼,新密碼在此為'leizm'

mysql>?set password=password('leizm');

Query OK, 0 rows affected, 1 warning (0.00 sec)

8、設定遠程登錄mysql。在Linux下為了安全,默認是不允許mysql本機以外的機器訪問mysql數(shù)據(jù)庫服務,因此需要重新授權root。方便遠程訪問。

mysql>?use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql>?select Host,User from user;

+-----------+-----------+

| Host ? ? ?| User ? ? ?|

+-----------+-----------+

| % ? ? ? ? | root ? ? ?|

| localhost | mysql.sys |

| localhost | root ? ? ?|

+-----------+-----------+

3 rows in set (0.00 sec)

mysql>?GRANT ALL PRIVILEGES ON *.* TO root@'%' identified by 'leizm';

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>?flush privileges;

Query OK, 0 rows affected (0.00 sec)

授權語句最后的‘leizm’是mysql數(shù)據(jù)庫root用戶的新密碼。

9、非必要的步驟,如果遠程連不上,估計是防火墻的問題,關閉試試:

[root@localhost mysql]#?service iptables stop

setenforce 0iptables:將鏈設置為政策 ACCEPT:filter ? ? ? ?[確定]

iptables:清除防火墻規(guī)則: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [確定]

iptables:正在卸載模塊: ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? [確定]

[root@localhost mysql]#?setenforce 0

setenforce: SELinux is disabled

用SQLyog遠程登錄訪問測試下:

安裝配置成功!

歡迎工作一到五年的Java工程師朋友們加入Java架構開發(fā): 854393687

群內提供免費的Java架構學習資料(里面有高可用、高并發(fā)、高性能及分布式、Jvm性能調優(yōu)、Spring源碼,MyBatis,Netty,Redis,Kafka,Mysql,Zookeeper,Tomcat,Docker,Dubbo,Nginx等多個知識點的架構資料)合理利用自己每一分每一秒的時間來學習提升自己,不要再用"沒有時間“來掩飾自己思想上的懶惰!趁年輕,使勁拼,給未來的自己一個交代!

?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容