于是乎去查看mysql的错误日志,cat /data/mysql/11Z.err
131204 09:09:15 mysqld_safe Starting mysqld daemon with databases from /data/mysql
/usr/local/mysql/bin/mysqld: File './mysql-bin.index' not found (Errcode: 13)
131204 9:09:15 [ERROR] Aborting
131204 9:09:15 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
131204 09:09:15 mysqld_safe mysqld from pid file /data/mysql/11Z.pid ended
131204 09:09:22 mysqld_safe Starting mysqld daemon with databases from /data/mysql
/usr/local/mysql/www.111cn.net/mysqld: File './mysql-bin.index' not found (Errcode: 13)
131204 9:09:22 [ERROR] Aborting
131204 9:09:22 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
131204 09:09:22 mysqld_safe mysqld from pid file /data/mysql/11Z.pid ended
提示./mysql-bin.index无法找到(由于mysql开启了bin日志功能),到数据库根目录查看该文件是存在的,可能是文件权限的问题,查看了数据库根目录的权限是700,所有者和用户组都是root,可能是上次转移数据库的时候不小心修改了文件夹的权限。
使用命令chown -R mysql.mysql /data/mysql/ 更改权限后,重新启动mysql,一切正常。
修改文件夹权限,OK
例
[root@XXXX mysql]# pwd
/var/lib/mysql
[root@XXXX mysql]# chown -R mysql:mysql binlogs
[root@XXXX mysql]#
[root@XXXX mysql]# /etc/init.d/mysql restart
MySQL manager or server PID file could not be found! [FAILED]
Starting MySQL. [ OK ]
[root@XXXX mysql]#