• 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 ]

  • 相关阅读:
    在IT行业工作如何获得高薪?选择前沿的技术,把准方向,有技术有人缘
    如何去做不想做的事情的 - 10个建议
    如何去做不想做的事情的 - 10个建议
    项目管理
    项目管理
    Spring Quartz 定时任务
    Spring Quartz 定时任务
    Spring @Transactional (一)
    Spring @Transactional (一)
    Search Insert Position
  • 原文地址:https://www.cnblogs.com/mediocreWorld/p/11094749.html
Copyright © 2020-2023  润新知