這篇文章主要介紹了centos6.5中rpm包安裝mysql5.7初始化出錯的解決方法,需要的朋友可以參考下
1、rz上傳到伺服器,解壓縮
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裝過,沒裝好,又卸載的情況下安裝,可能會出現如下情況:
在執行rpm -ivh mysql-community-server-5.7.19 -1.el6.i686.rpm
時,如果出現如下輸出:
有比較大的可能是因為資料目錄沒有清空,我們再往下手動初始化看看,執行以下指令:
[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
發現報錯了,拿錯誤訊息在百度上找了瞎,發現需要清空資料目錄:
從官方的文檔看到,資料目錄位置:
那就清空了再試試吧。
[root@mini2 upload]# rm -rf /var/lib/mysql/*
接下來初始化:
mysqld --initialize --user=mysql
接下來啟動mysql:
[root@mini2 upload]# service mysqld start
正在啟動mysqld: 我這邊之所以有兩個密碼,應該就是之前沒卸載乾淨,直覺應該用後邊的新密碼登入)
[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
[root@mini2 upload]# mysql -uroot -p
我這邊登入是ok了,密碼用的Adgwggdr%1e2
#5、修改密碼並允許其他機器上客戶端登入
#ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option
總結
以上是rpm套件在centos6.5中安裝mysql5.7初始化錯誤的解決方法的詳細內容。更多資訊請關注PHP中文網其他相關文章!