mysql故障:
[[email protected]_M ~]# /etc/init.d/mysqld restart
Starting MySQL....... ERROR! Manager of pid-file quit without updating file.
[[email protected]_M ~]#
可能一:
启动配置文件/etc/init.d/mysqld 中的basedir和datadir目录没有指定,默认找安装目录去了。需要就需要指定datadir的目录。
上面两个目录应该为初始化数据库时候指定的基础目录和数据目录。例如我的初始化目录为下面的命令。
/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/data --user=mysql
所以我修改为:
vim /etc/init.d/mysqld
46 basedir=/application/mysql
47 datadir=/data
可能二
mysqld的数据目录属主不是MYSQL,或者uid不对。也就是上面中的data目录的属主不对。修改为相同的属主即可。
chown -R mysql.mysql /data
可能三
是mysql下的tmp目录权限问题。导致无法创建socket.
日志中报下面的错误:
151105 13:42:49 InnoDB: Started; log sequence number 0 44233
151105 13:42:49 [ERROR] Can‘t start server : Bind on unix socket: Permission denied
151105 13:42:49 [ERROR] Do you already have another mysqld server running on socket: /application/mysql5.1.72/tmp/mysql.sock ?
151105 13:42:49 [ERROR] Aborting
查看/application/mysql/tmp权限问题
[[email protected]_S ~]# ll /application/mysql/
total 32
drwxr-xr-x 2 root root 4096 Nov 5 09:32 bin
drwxr-xr-x 3 root root 4096 Nov 4 23:55 include
drwxr-xr-x 3 root root 4096 Nov 4 23:55 lib
drwxr-xr-x 2 root root 4096 Nov 4 23:55 libexec
drwxr-xr-x 10 root root 4096 Nov 4 23:55 mysql-test
drwxr-xr-x 6 root root 4096 Nov 4 23:55 share
drwxr-xr-x 5 root root 4096 Nov 4 23:55 sql-bench
drwxr-xr-x 2 root root 4096 Nov 5 13:25 tmp
[[email protected]_S ~]#
发现/application/mysql/tmp这个目录的属主是root了。但是这个目录的属主本应该是mysql,也就是你用下面命令初始化数据库时指定的用户名
/application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/data --user=mysql
所以授权为mysql即可
[[email protected]_S ~]# chown mysql /application/mysql/tmp/
[[email protected]_S ~]# /etc/init.d/mysqld start
Starting MySQL. SUCCESS!
[[email protected]_S ~]#