Mysql服务在centos 7中未启动

n3schb8v  于 2022-11-07  发布在  Mysql
关注(0)|答案(2)|浏览(208)

我已经在我的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
wmvff8tz

wmvff8tz1#

您正在运行CentOS 7。运行以下命令:
系统状态mysqld.服务
如果没有显示错误,请尝试以下操作:
systemctl重新启动mysqld服务
如果失败,请运行以下命令:
对于ps auxf|grep mysqld|grep "grep" -v|awk '{print $2}'中i;做杀-9 $i;已完成
然后,运行以下命令:
systemctl启动mysqld服务
最后,为了确保它正常工作:
系统状态mysqld.服务

rseugnpd

rseugnpd2#

我已解决此问题,以下是解决方案
停止服务

systemctl停止mysqld

删除/var/lib/mysql中的所有文件和目录
文件名:
启动服务

systemctl启动mysqld

相关问题