zoukankan      html  css  js  c++  java
  • 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 ]

  • 相关阅读:
    Ruby 2
    Ruby 1
    莱布尼兹:与牛顿争吵了一生的斗士 微积分的奠基人之一―莱布尼茨
    如何实现html页面自动刷新
    css z-index的层级关系
    让网页变灰的实现_网站蒙灰CSS样式总汇
    利用CSS变量实现炫酷的悬浮效果
    离线电商数仓(十四)之系统业务数据仓库数据采集(一)电商业务简介
    离线电商数仓(十三)之用户行为数据采集(十三)采集通道启动/停止脚本
    离线电商数仓(十)之用户行为数据采集(十)组件安装(六)采集日志Flume(二)消费Kafka数据Flume
  • 原文地址:https://www.cnblogs.com/mediocreWorld/p/11094749.html
Copyright © 2011-2022 走看看