1、rz上傳到服務(wù)器,解壓縮
rz
[root@mini2 upload]# tar -xvf mysql-5.7.19-1.el6.i686.rpm-bundle.tar
2、安裝rpm包
rpm -ivh mysql-community-common-5.7.19-1.el6.i686.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el6.i686.rpm
rpm -ivh mysql-community-libs-compat-5.7.19-1.el6.i686.rpm
rpm -ivh mysql-community-client-5.7.19-1.el6.i686.rpm
rpm -ivh mysql-community-server-5.7.19-1.el6.i686.rpm
注意:如果不是全新安裝,而是之前用rpm裝過(guò),沒(méi)裝好,又卸載的情況下安裝,可能會(huì)出現(xiàn)如下情況:
在執(zhí)行rpm -ivh mysql-community-server-5.7.19-1.el6.i686.rpm
時(shí),如果出現(xiàn)如下輸出:
有比較大的可能是因?yàn)閿?shù)據(jù)目錄沒(méi)有清空,我們?cè)偻率謩?dòng)初始化看看,執(zhí)行以下命令:
[root@mini2 upload]# mysqld --initialize --user=mysql
2017-08-29T05:22:18.750237Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-29T05:22:18.754943Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2017-08-29T05:22:18.755064Z 0 [ERROR] Aborting
發(fā)現(xiàn)報(bào)錯(cuò)了,拿錯(cuò)誤信息在百度上找了瞎,發(fā)現(xiàn)需要清空數(shù)據(jù)目錄:
從官方的文檔看到,數(shù)據(jù)目錄位置:
那就清空了再試試吧。
[root@mini2 upload]# rm -rf /var/lib/mysql/*
接下來(lái)初始化:
mysqld --initialize --user=mysql
接下來(lái)啟動(dòng)mysql:
[root@mini2 upload]# service mysqld start
正在啟動(dòng) mysqld: [確定]
3、查找初始密碼(我這邊之所以有兩個(gè)密碼,應(yīng)該就是之前沒(méi)卸載干凈,直覺(jué)應(yīng)該用后邊的新密碼登錄)
[root@mini2 upload]# grep 'temporary password' /var/log/mysqld.log
2017-08-29T05:00:02.613275Z 1 [Note] A temporary password is generated for root@localhost: tzqjMvkHH3+C
2017-08-29T05:31:51.340338Z 1 [Note] A temporary password is generated for root@localhost: Adgwggdr%1e2
4、登錄
[root@mini2 upload]# mysql -uroot -p
我這邊登錄是ok了,密碼用的Adgwggdr%1e2
5、修改密碼并允許其他機(jī)器上客戶(hù)端登錄
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option
總結(jié)
以上所述是小編給大家介紹的centos6.5中rpm包安裝mysql5.7初始化出錯(cuò)的解決方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
您可能感興趣的文章:- centos7使用rpm安裝mysql5.7的教程圖解
- Centos7 安裝mysql 8.0.13(rpm)的教程詳解
- centos7上mysql8.0rpm方式安裝教程圖解
- CentOS 7下使用rpm包安裝mysql 5.7.18
- 阿里云 Centos7.3安裝mysql5.7.18 rpm安裝教程
- CentOS7使用rpm包安裝mysql 5.7.18
- Centos 7下使用RPM包安裝MySQL 5.7.9教程
- CentOS 7下使用RPM安裝mysql5.7.13
- centos7 用rpm安裝mysql詳解
- 淺析centos 7 mysql-8.0.19-1.el7.x86_64.rpm-bundle.tar