大网数据广告活动
服务器运维问答

Mysql. Bind on unix socket: Permission denied

· 52CE 我爱测

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 …

问题原文

原帖链接 · Aldwin · CC BY-SA 3.0

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

my.cnf:

    [mysqld]
    datadir=/var/lib/mysql
    socket=/var/lib/mysql/mysql.sock
    user=mysql
    tmpdir=/tmp
    # Disabling symbolic-links is recommended to prevent assorted security risks
    symbolic-links=0
    max_allowed_packet=256M

    [mysqld_safe]

    log-error=/var/log/mysqld.log
    pid-file=/var/run/mysqld/mysqld.pid

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

Any suggestions?

UPD1:

[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.

已采纳解答

原帖链接 · Abhishek Anand Amralkar · CC BY-SA 3.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-04-08)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。