今天试着更改了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.Vevb.com/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,一切正常.
修改文件夹权限,代码如一:
- [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]#
新闻热点
疑难解答