141017 9:30:32 [Warning] Using unique option prefix myisam_recover instead of myisam-recover-options is deprecated and will be removed in a future release. Please use the full name instead.
141017 9:30:32 [Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
141017 9:30:32 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
141017 9:30:32 InnoDB: The InnoDB memory heap is disabled
141017 9:30:32 InnoDB: Mutexes and rw_locks use InnoDB's own implementation
141017 9:30:32 InnoDB: Compressed tables use zlib 1.2.3
141017 9:30:32 InnoDB: Using Linux native AIO
141017 9:30:32 InnoDB: Initializing buffer pool, size = 128.0M
141017 9:30:32 InnoDB: Completed initialization of buffer pool
141017 9:30:32 InnoDB: highest supported file format is Barracuda.
141017 9:30:32 InnoDB: Waiting for the background threads to start
141017 9:30:33 InnoDB: 5.5.39 started; log sequence number 1595668
/usr/libexec/mysqld: File '/data/mysql/mysql_3306/logs/mysql-bin.000004' not found (Errcode: 13)
141017 9:30:33 [ERROR] Failed to open log (file '/data/mysql/mysql_3306/logs/mysql-bin.000004', errno 13)
141017 9:30:33 [ERROR] Could not open log file
141017 9:30:33 [ERROR] Can't init tc log
141017 9:30:33 [ERROR] Aborting
141017 9:30:33 InnoDB: Starting shutdown...
141017 9:30:34 InnoDB: Shutdown completed; log sequence number 1595668
141017 9:30:34 [Note] /usr/libexec/mysqld: Shutdown complete
现在error.log里很明显地指出errno为13,我们知道13就是权限问题,这个可以perror命令查看
[root@bak mysql]# perror 13
OS error code 13: Permission denied
位置可以通过which来定位
[root@bak mysql]# which perror
/usr/bin/perror
或者用find定位也是可以的
[root@bak mysql]# find / -name perror -print
/opt/mysql/mysql-5.5.39-linux2.6-i686/bin/perror
/usr/bin/perror
既然找到了无法启动的真正原因,那么对症下药,把权限问题解决,问题就可以搞定了
[root@bak mysql]# cd /data/mysql/mysql_3306/data
[root@bak data]# ll
total 410036
-rw-rw---- 1 mysql mysql 7950 Oct 17 09:30 error.log
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ibdata1
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ib_logfile0
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile1
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile2
drwx------ 2 root root 4096 Oct 17 09:28 mysql
drwx------ 2 root root 4096 Oct 17 09:28 performance_schema
drwx------ 2 root root 4096 Oct 17 09:28 test
[root@bak data]# chown -R mysql:mysql ./
[root@bak data]# ll
total 410036
-rw-rw---- 1 mysql mysql 7950 Oct 17 09:30 error.log
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ibdata1
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:30 ib_logfile0
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile1
-rw-rw---- 1 mysql mysql 104857600 Oct 17 09:25 ib_logfile2
drwx------ 2 mysql mysql 4096 Oct 17 09:28 mysql
drwx------ 2 mysql mysql 4096 Oct 17 09:28 performance_schema
drwx------ 2 mysql mysql 4096 Oct 17 09:28 test
开始还去调整了/data/mysql/mysql_3306/data目录下面几个数据库的权限,但发现依然无法启动,看来不是这几个目录的权限问题
[root@bak data]# mysqld_safe &
[1] 2988
[root@bak data]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
[root@bak data]# mysqlSTOPPING server from pid file /data/mysql/mysql_3306/data/bak.pid
141017 09:32:08 mysqld ended
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[1]+ Done mysqld_safe
error.log日志内容和之前一样,仍然报errno 13,就不贴了。针对之前给出的error.log日志里提示的对mysql-bin.000004读写权限的问题做一下处理
[root@bak mysql]# cd /data/mysql/mysql_3306/logs
[root@bak logs]# ll
total 1092
-rw-rw---- 1 mysql mysql 107 Oct 17 09:25 mysql-bin.000001
-rw-rw---- 1 mysql mysql 107 Oct 17 09:26 mysql-bin.000002
-rw-rw---- 1 root root 27681 Oct 17 09:28 mysql-bin.000003
-rw-rw---- 1 root root 1070549 Oct 17 09:28 mysql-bin.000004
-rw-rw---- 1 mysql mysql 180 Oct 17 09:28 mysql-bin.index
[root@bak logs]# chown -R mysql:mysql ./
[root@bak logs]# ll
total 1092
-rw-rw---- 1 mysql mysql 107 Oct 17 09:25 mysql-bin.000001
-rw-rw---- 1 mysql mysql 107 Oct 17 09:26 mysql-bin.000002
-rw-rw---- 1 mysql mysql 27681 Oct 17 09:28 mysql-bin.000003
-rw-rw---- 1 mysql mysql 1070549 Oct 17 09:28 mysql-bin.000004
-rw-rw---- 1 mysql mysql 180 Oct 17 09:28 mysql-bin.index
原来是root root权限,改为mysql mysql了,再次启动MySQL进程
[root@bak logs]# ps -ef|grep mysql
root 3060 2591 0 09:35 pts/0 00:00:00 grep mysql
[root@bak logs]# mysqld_safe &
[1] 3061
[root@bak logs]# Starting mysqld daemon with databases from /data/mysql/mysql_3306/data
[root@bak logs]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.39-log MySQL Community Server (GPL)
Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
(testing)root@localhost [(none)]> exit
[root@bak logs]# ps aux | grep -v grep | grep mysql
root 3061 0.0 0.1 4484 1152 pts/0 S 09:35 0:00 /bin/sh /usr/bin/mysqld_safe