【问题标题】:Mysql service is not starting in centos 7mysql服务在centos 7中没有启动
【发布时间】:2022-01-07 01:02:32
【问题描述】:

我在我的 centos 7.9 机器上安装了 mysql-community-server,它的服务没有启动并且在启动服务时给我错误,因为我也无法运行 mysql_secure_installation 脚本

这是我在启动服务时遇到的错误

 systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

这是日志详细信息

 tail -n 20 /var/log/mysqld.log
2021-11-30T09:38:45.003421Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-11-30T09:38:45.045895Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 2 in a file operation.
2021-11-30T09:38:45.045946Z 1 [ERROR] [MY-012593] [InnoDB] The error means the system cannot find the path specified.
2021-11-30T09:38:45.045966Z 1 [ERROR] [MY-012594] [InnoDB] If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-11-30T09:38:45.045981Z 1 [ERROR] [MY-012646] [InnoDB] File ./ibdata1: 'open' returned OS error 71. Cannot continue operation
2021-11-30T09:38:45.045997Z 1 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.
2021-11-30T09:38:50.955262Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 55847
2021-11-30T09:38:51.008326Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-11-30T09:38:51.036852Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 2 in a file operation.
2021-11-30T09:38:51.036942Z 1 [ERROR] [MY-012593] [InnoDB] The error means the system cannot find the path specified.
2021-11-30T09:38:51.036968Z 1 [ERROR] [MY-012594] [InnoDB] If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-11-30T09:38:51.036983Z 1 [ERROR] [MY-012646] [InnoDB] File ./ibdata1: 'open' returned OS error 71. Cannot continue operation
2021-11-30T09:38:51.037057Z 1 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.
2021-11-30T09:38:57.011572Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.27) starting as process 55900
2021-11-30T09:38:57.034554Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-11-30T09:38:57.062981Z 1 [ERROR] [MY-012592] [InnoDB] Operating system error number 2 in a file operation.
2021-11-30T09:38:57.063054Z 1 [ERROR] [MY-012593] [InnoDB] The error means the system cannot find the path specified.
2021-11-30T09:38:57.063079Z 1 [ERROR] [MY-012594] [InnoDB] If you are installing InnoDB, remember that you must create directories yourself, InnoDB does not create them.
2021-11-30T09:38:57.063101Z 1 [ERROR] [MY-012646] [InnoDB] File ./ibdata1: 'open' returned OS error 71. Cannot continue operation
2021-11-30T09:38:57.063118Z 1 [ERROR] [MY-012981] [InnoDB] Cannot continue operation.

我已经尝试了所有解决方案,但无法弄清楚它有什么问题。 这是我的 /etc/my.conf 文件详细信息。

# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/8.0/en/server-configuration-defaults.html

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

【问题讨论】:

    标签: mysql centos centos7


    【解决方案1】:

    你正在运行 CentOS 7。运行这个:

    systemctl status mysqld.service

    如果没有出现错误,试试这个:

    systemctl 重启 mysqld.service

    如果失败,运行这个:

    对于我在ps auxf|grep mysqld|grep "grep" -v|awk '{print $2}';杀死 -9 $i;完成

    然后,运行这个:

    systemctl 启动 mysqld.service

    最后,确保它正常工作:

    systemctl status mysqld.service

    【讨论】:

    • 这里是您建议的命令的状态#systemctl status mysqld ● mysqld.service - MySQL 服务器已加载:已加载(/usr/lib/systemd/system/mysqld.service;已启用;供应商预设:已禁用)活动:自 2021 年 12 月 1 日星期三 09:55:58 PKT 起激活(开始); 5s 前 文档:man:mysqld(8) dev.mysql.com/doc/refman/en/using-systemd.html Process: 29785 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 29821 (mysqld) Status: "Server startup in progress" CGroup: /system.slice/mysqld.service └─29821 /usr/sbin/mysqld
    • #systemctl restart mysqld mysqld.service 的作业失败,因为控制进程以错误代码退出。详见“systemctl status mysqld.service”和“journalctl -xe”。
    • # ps auxf|grep mysqld|grep "grep" -v|awk '{print $2}';杀死 -9 $i; -bash:意外标记“do”附近的语法错误
    【解决方案2】:

    我已经解决了以下问题

    停止服务

    #systemctl 停止 mysqld

    从 /var/lib/mysql 中删除所有文件和目录

    #rm -rf /var/lib/mysql/*

    启动服务

    #systemctl 启动mysqld

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-31
      • 2020-07-12
      • 1970-01-01
      • 1970-01-01
      • 2015-07-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多