mysql的错误:The server quit without updating PID file /usr/local/mysql/data/door.pid).

mysql错误解决:

先 参考:http://www.jb51.net/article/48625.htm

参考第四条:

mysql在启动时没有指定配置文件时会使用/etc/my.cnf配置文件,请打开这个文件查看在[mysqld]节下有没有指定数据目录(datadir)。

mysql版本:mysql  Ver 14.14 Distrib 5.5.44, for linux2.6 (i686) using readline 5.1


错误原因:my.conf放置在/etc目录下,当安装mysql-admin(mysql客户端,里面包含了mysql-common等包,)后,, 问题出现

toor@door:/lib$ sudo /etc/init.d/mysql.server start
Starting MySQL
. * The server quit without updating PID file (/var/lib/mysql/door.pid).
toor@door:/lib$ clear

然后卸载mysql-admin(同时相应的包也卸载掉了):

toor@door:/lib$ sudo /etc/init.d/mysql.server start
/usr/local/mysql/bin/my_print_defaults: Can't read dir of '/etc/mysql/conf.d/' (Errcode: 2)  
Fatal error in defaults handling. Program aborted
Starting MySQL
. * The server quit without updating PID file (/usr/local/mysql/data/door.pid).
toor@door:/lib$ cd /etc/
toor@door:/etc$ ls |grep mysql
mysql
toor@door:/etc$ cd mysql/
toor@door:/etc/mysql$ ls
my.cnf
问题发生变化!


然后再安装mysql-admin客户端

toor@door:/lib$ sudo /etc/init.d/mysql.server start
Starting MySQL
. * The server quit without updating PID file (/var/lib/mysql/door.pid).

然后把/etc目录下的my.conf文件移动到/etc/mysql/目录下(这里覆盖了安装某些包生成的默认my.cnf文件。

toor@door:/etc$ sudo mv my.cnf mysql
toor@door:/etc$ cd mysql
toor@door:/etc/mysql$ ls
conf.d  my.cnf
toor@door:/etc/mysql$ gedit my.cnf
toor@door:/etc/mysql$ ls
conf.d  my.cnf
toor@door:/etc/mysql$ sudo /etc/init.d/mysql.server start
Starting MySQL
... *
toor@door:/etc/mysql$ sudo /etc/init.d/mysql.server status
 * MySQL running (9965)



要注意的是,mysql的配置文件有一个加载顺序,加载顺序参考:http://www.linuxidc.com/Linux/2012-02/53855.htm


会先加载/etc/mysql/my.cnf,如果安装了某些软件,在/etc/mysql目录下创建了my.cnf,然而这个文件是新生成的默认文件,却不是我们的配置文件,启动的过程加载就不成功了!所以安装了某些包后出现启动不成功!当这些包或者程序卸载后如果my.cnf也没有删除掉的话,仍然启动失败!


以上说的是mysql5.54版本!! 仅供参考!!!


posted @ 2015-07-11 21:25  徐徐徐徐徐徐  阅读(3024)  评论(0编辑  收藏  举报