Mysql服务启动错误之(MySQL manager or server PID file could not be found)

对于类似的错误,网上很多,但是多归多,找到解决思路的方法才是最为重要的!现在我们来看,当我执行

[root@cacti init.d]# service mysqld start
Starting MySQL...................................          [FAILED]

无法启动,/etc/init.d/mysqld  start仍然无法启动,对于无法启动,或者其他异常的信息出现时,我们首先应该找到错误,通过什么,日志,是一个有力的反馈给我的信息捷径。。

于是,到/usr/local/mysql/var/查看日志文件*.err的文件,我们vim编辑看下里面的内容

120919 17:19:31  mysqld started
120919 17:19:31  InnoDB: Started; log sequence number 0 43655
120919 17:19:31 [Note] /usr/local/mysql/libexec/mysqld: ready for connections.
Version: '5.0.22-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
120919 17:41:09 [Note] /usr/local/mysql/libexec/mysqld: Normal shutdown


120919 17:41:09  InnoDB: Starting shutdown...
120919 17:41:11  InnoDB: Shutdown completed; log sequence number 0 43655
120919 17:41:11 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


120919 17:41:11  mysqld ended


120919 17:41:12  mysqld started
^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
120919 17:41:12 [ERROR] Aborting


120919 17:41:12 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


120919 17:41:12  mysqld ended


120919 17:42:07  mysqld started
^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
120919 17:42:07 [ERROR] Aborting


^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
120919 17:41:12 [ERROR] Aborting


120919 17:41:12 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


120919 17:41:12  mysqld ended


120919 17:42:07  mysqld started
^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
120919 17:42:07 [ERROR] Aborting


120919 17:42:07 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


120919 17:42:07  mysqld ended


120919 17:42:54  mysqld started
^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
120919 17:42:54 [ERROR] Aborting


120919 17:42:54 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


120919 17:42:54  mysqld ended


120919 17:43:57  mysqld started
^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
120919 17:43:57 [ERROR] Aborting


120919 17:43:57 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete


120919 17:43:57  mysqld ended


120919 17:51:30  mysqld started
^G/usr/local/mysql/libexec/mysqld: File './mysql-bin.index' not found (Errcode: 13)
120919 17:51:30 [ERROR] Aborting

看到红色错误了吗?是找不到mysql-bin.index文件,当我退出编辑状态,回到/usr/local/mysql/var目录下可以明细看到又该文件!以下为信息

[root@cacti var]# ll
total 21880
drwx------ 2 root  mysql    12288 Sep 19 16:42 cactidb
-rw-rw---- 1 mysql mysql     6433 Sep 20 13:05 cacti.err
-rw-rw---- 1 root  mysql 10485760 Sep 19 17:41 ibdata1
-rw-rw---- 1 root  mysql  5242880 Sep 19 17:41 ib_logfile0
-rw-rw---- 1 root  mysql  5242880 Sep 19 13:13 ib_logfile1
drwx------ 2 root  mysql     4096 Sep 19 13:12 mysql
-rw-rw---- 1 root  mysql    15117 Sep 19 13:12 mysql-bin.000001
-rw-rw---- 1 root  mysql   484379 Sep 19 13:12 mysql-bin.000002
-rw-rw---- 1 root  mysql   281933 Sep 19 16:52 mysql-bin.000003
-rw-rw---- 1 root  mysql      117 Sep 19 16:52 mysql-bin.000004
-rw-rw---- 1 root  root      117 Sep 19 17:19 mysql-bin.000005
-rw-rw---- 1 root  root    484379 Sep 19 17:19 mysql-bin.000006
-rw-rw---- 1 root  root      255 Sep 19 17:41 mysql-bin.000007
-rw-rw---- 1 root mysql      133 Sep 19 17:19 mysql-bin.index
drwx------ 2 root  mysql     4096 Sep 19 13:12 test

于是,我再次查看/etc/init.d/mysqld这个启动文件查看启动这个文件的变量,完全没有差异,/etc/my.cnf也没有任何的错误配置。这里我想到了权限的设置(蓝色的提示),这是想起权限出现了问题,mysqld无法读取改文件,做一下命令即可变更权限设置

[root@cacti mysql]# chown -R root .
[root@cacti mysql]# chgrp -R mysql .
[root@cacti mysql]# chown -R mysql var
[root@cacti mysql]# ll
total 80
drwxr-xr-x 2 root  mysql 4096 Sep 19 17:19 bin
drwxr-xr-x 3 root  mysql 4096 Sep 19 13:09 include
drwxr-xr-x 2 root  mysql 4096 Sep 19 17:19 info
drwxr-xr-x 3 root  mysql 4096 Sep 19 13:09 lib
drwxr-xr-x 2 root  mysql 4096 Sep 19 17:19 libexec
drwxr-xr-x 3 root  mysql 4096 Sep 19 13:10 man
drwxr-xr-x 7 root  mysql 4096 Sep 19 17:19 mysql-test
drwxr-xr-x 3 root  mysql 4096 Sep 19 13:10 share
drwxr-xr-x 5 root  mysql 4096 Sep 19 17:19 sql-bench
drwx------ 5 mysql mysql 4096 Sep 20 13:12 var

变更完成后,启动成功,以下为提示信息,

[root@cacti var]# service mysqld start
Starting MySQL                                             [  OK  ]

总结:

遇到错误一定要看错误提示信息,从哪里我们可以找到原始的提示信息,可以给出我们提出相关的解决方案的思路!

你可能感兴趣的:(Mysql-异常处理)