MySQL 守护进程无法启动 - centos 6

2022-01-05 00:00:00 centos6 php mysql phpmyadmin

查看带有复选标记的答案评论以解决您的问题.

Look at the checkmarked answer comments to get your issue solved.

每当我尝试启动 SQLD 服务时,我都会遇到 MySQL Daemon Failed to Start.我实际上尝试通过执行以下操作来启动"服务:

Whenever I try to start the SQLD service I get MySQL Daemon Failed to Start. I infact tried to "start" the service by doing the following:

service mysqld start

还有

当我输入:mysql

我明白了:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

我知道那个目录下应该有一个mysql.sock文件,所以我创建了一个.但是文件只是自动删除了它自己,我继续收到错误 2002.

I know that there should be a mysql.sock file in that directory, so I create one. But the file just auto removes its self and I continue to get the error 2002.

由于错误,我也无法登录 PHPMyAdmin.我可以访问 phpmyadmin 页面,但在登录时出现:#2002 无法登录 MySQL 服务器

I am also unable to log into PHPMyAdmin due to the error. I can access phpmyadmin page but when logging in I get: #2002 Cannot log in to the MySQL server

这是我的 mysql.log 文件:

Here is my mysql.log file:

131201 13:05:07 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
131201 13:18:18 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
131201 13:18:18 [Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
131201 13:18:18 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
131201 13:18:18 InnoDB: The InnoDB memory heap is disabled
131201 13:18:18 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131201 13:18:18 InnoDB: Compressed tables use zlib 1.2.3
131201 13:18:18 InnoDB: Using Linux native AIO
131201 13:18:18 InnoDB: Initializing buffer pool, size = 128.0M
131201 13:18:18 InnoDB: Completed initialization of buffer pool
131201 13:18:18  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
131201 13:18:18 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

我运行了 mysql_upgrade 并得到了

I ran mysql_upgrade and got

Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
FATAL ERROR: Upgrade failed

推荐答案

这个错误最可能的原因是你的 mysql 服务器没有运行.当您输入 mysql 时,您正在执行 mysql 客户端.

The most likely cause for this error is that your mysql server is not running. When you type in mysql you are executing mysql client.

试试:

# sudo service mysql start
# mysql

更新(在问题中包含 OP 后的日志;摘自下面的评论):

Update (after OP included log in the question; taken from the comments below):

谢谢,看到你的日志了.日志说 mysql 用户没有适当的访问权限.我假设你的 mysql 用户是 mysql(这可以在/etc/my.cnf中验证,执行

Thanks, saw your log. The log is saying the mysql user doesn't have proper access rights. I'm assuming your mysql user is mysql(this can be verified in /etc/my.cnf, execute

chown -R mysql:mysql/var/lib/mysql

并再次尝试启动 mysqld.

相关文章