萬盛學電腦網

 萬盛學電腦網 >> 數據庫 >> mysql教程 >> Mysql啟動報錯’./mysql

Mysql啟動報錯’./mysql

今天試著更改了mysql的數據存儲目錄(如何更改mysql的存儲目錄),但是啟動mysql一直提示Starting MySQL. ERROR! The server quit without updating PID file (/data/mysql/11Z.pid)


於是乎去查看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]#

copyright © 萬盛學電腦網 all rights reserved