I can not connect to the Mysql server; Unable to create / write pid file

Hello, I cannot 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, he 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
+5
source share
4 answers

I had a problem with mysql. I run as root, but I don’t know why this error occurs. The problem is that the mysql user does not have permission to create the pid file in /var/run/mysqld. A full log might look like this:

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

Thus, the solution assigns the mysql user to this directory:

# chown mysql:mysql /var/run/mysqld

and then run mysqld

# service mysqld start
+8
source

Redhat , .

+2

2 Netflix :

chmod -R 777 /usr/local/mysql
chmod -R 777 /usr/local/mysql-5.6.19-osx10.7-x86_64

... OSX Mavericks. PITA.

+1

- /var/log/mysqld.log

chown mysql:mysql /var/run/mysqld
0

All Articles