Can't start mysql with:

130408 11:31:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
/usr/libexec/mysqld: Table 'plugin' is read only
130408 11:31:22 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
130408 11:31:22  InnoDB: Initializing buffer pool, size = 8.0M
130408 11:31:22  InnoDB: Completed initialization of buffer pool
130408 11:31:23  InnoDB: Started; log sequence number 0 19514977
130408 11:31:23 [ERROR] Can't start server : Bind on unix socket: Permission denied
130408 11:31:23 [ERROR] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
130408 11:31:23 [ERROR] Aborting

130408 11:31:23  InnoDB: Starting shutdown...
130408 11:31:28  InnoDB: Shutdown completed; log sequence number 0 19514977
130408 11:31:28 [Note] /usr/libexec/mysqld: Shutdown complete
130408 11:31:28 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

Another mysql is not runnig:

[root@triton667 etc]# ps ax | grep mysql
 9195 pts/1    S+     0:00 grep mysql


    # Disabling symbolic-links is recommended to prevent assorted security risks



Permissions on "/tmp" and "/var/lib/mysql" are 777/

Any suggestions?


[root@triton667 etc]# mysql_upgrade
Looking for 'mysql' as: mysql
Looking for 'mysqlcheck' as: mysqlcheck
Running 'mysqlcheck with default connection arguments
mysqlcheck: Got error: 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) trying to connect
FATAL ERROR: Upgrade failed

UPD2: plugin.MYD, plugin.MYI and plugin.frm are exists in /var/lib/mysql/mysql/.

Nothing running on port 3306.

mysql.sock does not exist. I tried to create it myself, but after restart it was removed.

mount(all rw):

[root@triton667 mysql]# mount
/dev/md1 on / type ext4 (rw,noatime,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/md0 on /boot type ext2 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)

This problem appeared today when I tried to clone my site on a subdomain.

  • run mysql_upgrade as suggested?
    – NickW
    Apr 8, 2013 at 10:05
  • No. touch /var/lib/mysql/mysql.sock - Also does not work
    – Aldwin
    Apr 8, 2013 at 10:14
  • Is there a plugin.MYD, plugin.MYI and plugin.frm file under /var/lib/mysql/mysql ?
    – NickW
    Apr 8, 2013 at 10:17
  • Also, does the mysql.sock file exist in the /var/lib/mysql directory?
    – NickW
    Apr 8, 2013 at 10:18
  • Is something already running on 3306 port?
    – aardvark
    Apr 8, 2013 at 10:26

6 Answers 6


1) First make sure you delete the existing socket file using the rm command.

rm /var/lib/mysql/mysql.sock

2) Kill all existing MySQL processes via the following command.

service mysql stop

3) Very important: Make sure the permission for the MySQL database directory under /var/lib/ folder should be mysql:root

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

4) With the above information you should be able to start MySQL successfully and the socket file should be created successfully under the database directory.

service mysql start
  • I use a Ubuntu Server, and this didn't worked. Dec 10, 2015 at 17:25

Thanks to @Abhishek's answer combined with mysqld output(Can't use /var/run/mysqld/mysqld.sock) I managed to solve this with one command:

chown -R mysql:root /var/run/mysqld

Then it starts properly:

root@***:~# service mysql start
df: Warning: cannot read table of mounted file systems: No such file or directory
[ ok ] Starting MySQL database server: mysqld ..
[info] Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly..
  • 1
    Your welcome from the future :) Nov 30, 2016 at 8:32

Your problem can be caused by any condition that prevents the MySQL daemon from writing a socket file to the path /var/lib/mysql. The other answers, such as a read-only filesystem or incorrect directory ownership, address various reasons that MySQL may not be able to write to the socket.

Another possible reason is that /var/lib/mysql may have the incorrect SELinux context. You can diagnose this condition by checking for recent SELinux AVC denials after attempting to start the MySQL daemon:

ausearch -m avc --start recent

If SELinux is denying access to create the socket file, you will see an error message like this:

time->Thu Feb  2 03:46:27 2017
type=SYSCALL msg=audit(1566106187.784:152): arch=c000004e syscall=49 success=no exit=-13 a0=4f a1=7ff3fd652e80 a2=6e a3=7fcd2d6523d40 items=0 ppid=1 pid=1820 auid=4294967295 uid=996 gid=994 euid=996 suid=996 fsuid=996 egid=994 sgid=994 fsgid=994 tty=(none) ses=4294967295 comm="mysqld" exe="/usr/sbin/mysqld" subj=system_u:system_r:mysqld_t:s0 key=(null)
type=AVC msg=audit(1566106187.784:152): avc:  denied  { create } for  pid=1820 comm="mysqld" name="mysql.sock" scontext=system_u:system_r:mysqld_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=sock_file

To resolve an SELinux denial, try to restore the default context of the directory (your distribution should set the correct context of mysqld_db_t when you installed MySQL or MariaDB):

restorecon -R -v -f /var/lib/mysql

If you have customized the contexts on your system, fixing the problem is beyond the scope of this post.

  • On CentOS 7 with SELinux this is what I was facing and restoring the context fixed it.
    – Ken J
    Aug 1, 2017 at 19:08

Based on what you write, I would suggest that you check if your filesystem is mounted read-only.

130408 11:31:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql /usr/libexec/mysqld: Table 'plugin' is read only


I tried all of the other answers to resolve the issue. It appears that when i set selinux to permissive: setenforce 0 I could start the server.

I then amended the sock directory /var/lib/mysql granting selinux permissions to the directory:

semanage fcontext -a -t mysqld_db_t "/var/lib/mysql(/.*)?"
restorecon -R -v -f /var/lib/mysql

Once done, i enable selinux using setenforce 1 started the mysql service and all was well.

Hope this helps others.


While the selected answer might do the trick, I had no luck with it. Only after following this suggestion to kill mysql processes I could then reboot and mysql was up.

Interestingly enough, in my case mysql was up after powering down and up again, but not after a reboot from the command line (and would not be started. except power off and on again)

Otherwise the symptoms were the same.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.