centos6.9下rpm方式安装mysql后mysql服务无法启动

mac2022-06-30  65

以下两种方式启动都报错:启动失败:

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

 

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

 

原因:旧版本的MySQL软件移除时没有删除原来的数据文件,即 /var/lib/mysql/路径下的内容。

解决方法:删除该路径下的所有内容,包括文件和文件夹。

 

再次启动,报错另一个错误:

[root@node03 ~]# service mysqld startInitializing 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=457902019-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 startInitializing 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 startInitializing 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=457902019-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 ]

 

转载于:https://www.cnblogs.com/mediocreWorld/p/11094749.html

最新回复(0)