linux(centos6.9)下rpm方式安裝mysql后mysql服務無法啟動


以下兩種方式啟動都報錯:啟動失敗:

[root@node03 ~]# service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

 

[root@node03 ~]# /etc/init.d/mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

 

原因:舊版本的MySQL軟件移除時沒有刪除原來的數據文件,即 /var/lib/mysql/路徑下的內容。

解決方法:刪除該路徑下的所有內容,包括文件和文件夾。

 

再次啟動,報錯另一個錯誤:

[root@node03 ~]# service mysqld start
Initializing MySQL database: 2019-06-26T16:37:53.977336Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-26T16:37:54.359914Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-06-26T16:37:54.431696Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-06-26T16:37:54.502670Z 0 [ERROR] unknown variable 'default-character-set=utf8'
2019-06-26T16:37:54.502687Z 0 [ERROR] Aborting

[FAILED]

原因:/etc/my.cnf的配置文件中,我配置了default-character-set,但MySQL5.7貌似不認該參數。

解決方法:把所有的default-character-set配置項注釋掉,或刪除掉。

 

再次啟動,報第三個錯誤:

[root@node03 ~]# service mysqld start
Initializing MySQL database: 2019-06-26T16:46:34.713514Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-06-26T16:46:34.715422Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2019-06-26T16:46:34.715447Z 0 [ERROR] Aborting

[FAILED]

原因:由於第二次的啟動失敗,在/var/lib/mysql/路徑下殘留了一些文件,由於MySQL初始化時需要該路徑下沒有任何內容,所以啟動失敗。

解決方法:清空該路徑下的所有內容。

 

再次啟動,成功!

[root@node03 ~]# service mysqld start
Initializing MySQL database: 2019-06-26T16:47:53.295945Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp se er option (see documentation for more details).
2019-06-26T16:47:53.633116Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-06-26T16:47:53.699952Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-06-26T16:47:53.817335Z 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: 246937da-9832-11e9-9e76-00505632a066.
2019-06-26T16:47:53.826311Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-06-26T16:47:53.832203Z 1 [Note] A temporary password is generated for root@localhost: nlaJ#thW=9zQ
[ OK ]
Starting mysqld: [ OK ]

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM