无法连接到Mysql服务器;无法创建/写入pid文件 [英] Cant connect to Mysql server ; Can't create/write the pid file

查看:1794
本文介绍了无法连接到Mysql服务器;无法创建/写入pid文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我不能连接到我的mysql服务器,我得到以下错误

Hello I cant seem to connect to my mysql server, i get the following error

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111)

当我检查日志,它显示了以下内容:

when i checked the logs , it showed me the following :

130314 12:36:16 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'plugin' is read only
130314 12:36:16 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
130314 12:36:16  InnoDB: Initializing buffer pool, size = 8.0M
130314 12:36:16  InnoDB: Completed initialization of buffer pool
130314 12:36:16  InnoDB: Started; log sequence number 13 1336891001
130314 12:36:16 [ERROR] /usr/sbin/mysqld: Can't create/write to file '/var/lib/mysql/live.pid' (Errcode: 13)
130314 12:36:16 [ERROR] Can't start server: can't create PID file: Permission denied


推荐答案

我有mysql的样例问题。我运行根权限,但不知道为什么这个错误发生。问题是mysql用户没有权限在 / var / run / mysqld 中创建pid文件。
完整日志可能如下所示:

I had sample problem with mysql. I run under root permission but don't known why this error happen. The problem is mysql user don't have permission to create pid file in /var/run/mysqld. Full log could look like:

140812 09:35:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
140812  9:35:53  InnoDB: Initializing buffer pool, size = 8.0M
140812  9:35:53  InnoDB: Completed initialization of buffer pool
140812  9:35:53  InnoDB: Started; log sequence number 0 197396648
140812  9:35:53 [ERROR] /usr/libexec/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 13)
140812  9:35:53 [ERROR] Can't start server: can't create PID file: Permission denied
140812 09:35:53 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

因此,解决方案是将mysql用户分配到此目录:

So the solution is assign mysql user to this directory:

# chown mysql:mysql /var/run/mysqld

然后启动mysqld

and then start mysqld

# service mysqld start

这篇关于无法连接到Mysql服务器;无法创建/写入pid文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆