我重启我的服务器后,我无法启动mysql:
$ sudo service mysql start
$ Starting MySQL. ERROR! Manager of pid-file quit without updating file.
$ Starting MySQL. ERROR! Manager of pid-file quit without updating file.
“/var/log/mysqld.log”显示: 150225 21:39:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150225 21:39:49 [Note] Plugin 'FEDERATED' is disabled. /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 150225 21:39:49 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 150225 21:39:49 InnoDB: Initializing buffer pool, size = 8.0M 150225 21:39:49 InnoDB: Completed initialization of buffer pool InnoDB: Log scan progressed past the checkpoint lsn 0 37356 150225 21:39:49 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 0 44233 150225 21:39:49 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 150225 21:39:49 InnoDB: Started; log sequence number 0 44233 150225 21:39:49 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 150225 21:39:49 mysqld_safe mysqld from pid file /var/lib/mysql/iZ23aa67ovhZ.pid ended
150225 21:39:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150225 21:39:49 [Note] Plugin 'FEDERATED' is disabled. /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 150225 21:39:49 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 150225 21:39:49 InnoDB: Initializing buffer pool, size = 8.0M 150225 21:39:49 InnoDB: Completed initialization of buffer pool InnoDB: Log scan progressed past the checkpoint lsn 0 37356 150225 21:39:49 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 0 44233 150225 21:39:49 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 150225 21:39:49 InnoDB: Started; log sequence number 0 44233 150225 21:39:49 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 150225 21:39:49 mysqld_safe mysqld from pid file /var/lib/mysql/iZ23aa67ovhZ.pid ended
150225 21:39:49 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150225 21:39:49 [Note] Plugin 'FEDERATED' is disabled. /usr/local/mysql/bin/mysqld: Table 'mysql.plugin' doesn't exist 150225 21:39:49 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it. 150225 21:39:49 InnoDB: Initializing buffer pool, size = 8.0M 150225 21:39:49 InnoDB: Completed initialization of buffer pool InnoDB: Log scan progressed past the checkpoint lsn 0 37356 150225 21:39:49 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... InnoDB: Doing recovery: scanned up to log sequence number 0 44233 150225 21:39:49 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Apply batch completed 150225 21:39:49 InnoDB: Started; log sequence number 0 44233 150225 21:39:49 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 150225 21:39:49 mysqld_safe mysqld from pid file /var/lib/mysql/iZ23aa67ovhZ.pid ended
,我的硬盘没有装满。
这里是/ var / lib / mysql的状态: drwxrwxrwx 2 mysql root 4096 Feb 26 16:43 . drwxr-xr-x. 21 root root 4096 Feb 25 19:38 .. -rw-rw---- 1 mysql mysql 10485760 Feb 25 19:38 ibdata1 -rw-rw---- 1 mysql mysql 5242880 Feb 26 16:43 ib_logfile0 -rw-rw---- 1 mysql mysql 5242880 Feb 25 19:38 ib_logfile1
drwxrwxrwx 2 mysql root 4096 Feb 26 16:43 . drwxr-xr-x. 21 root root 4096 Feb 25 19:38 .. -rw-rw---- 1 mysql mysql 10485760 Feb 25 19:38 ibdata1 -rw-rw---- 1 mysql mysql 5242880 Feb 26 16:43 ib_logfile0 -rw-rw---- 1 mysql mysql 5242880 Feb 25 19:38 ib_logfile1
drwxrwxrwx 2 mysql root 4096 Feb 26 16:43 . drwxr-xr-x. 21 root root 4096 Feb 25 19:38 .. -rw-rw---- 1 mysql mysql 10485760 Feb 25 19:38 ibdata1 -rw-rw---- 1 mysql mysql 5242880 Feb 26 16:43 ib_logfile0 -rw-rw---- 1 mysql mysql 5242880 Feb 25 19:38 ib_logfile1
这里是/etc/my.cnf:[mysqld [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
服务器上没有mysql_install_db: bash: mysql_install_db: command not found
,当我运行mysql_safe时,显示: 150226 16:58:50 mysqld_safe Logging to '/var/log/mysqld.log'. 150226 16:58:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150226 16:58:50 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
150226 16:58:50 mysqld_safe Logging to '/var/log/mysqld.log'. 150226 16:58:50 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150226 16:58:50 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
非常感谢!
150225 21:39:49 [错误]致命错误:无法打开和locking权限表:表'mysql.host'不存在
要解决这个问题,你只需要告诉mysql在哪里看,而不是默认安装被移动。 你可以这样做:
mysql_install_db –user=mysql –ldata=/newlocation
一旦你这样做,你可以重新启动MySQL
/etc/init.d/mysqld restart
如果没有帮助:
yum remove mysql*
/usr/bin/mysql
和/var/lib/mysql
/etc/my.cnf.rmp
文件 ps -e
来检查进程,以确保mysql还没有运行。 yum install mysql-server
。 这也似乎安装MySQL客户端作为依赖。 chown -R mysql /var/lib/mysql
和chgrp -R mysql /var/lib/mysql
service mysqld start
来启动MySQL守护进程。 InnoDB:数据库没有正常closures! InnoDB:启动崩溃恢复。 InnoDB:从.ibd文件中读取表空间信息… InnoDB:从双写入InnoDB缓冲区中恢复可能的一半写入数据页…
这是崩溃后的正常输出。 InnoDB旨在在这些情况下自动恢复,但可能需要一些时间。 通常是几分钟,但如果在内存中有成千上万的修改过的数据页面时发生崩溃,则可能需要几个小时,而且磁盘速度很慢。
在大多数情况下,InnoDB可以自行恢复,不会丢失数据。
要开始恢复,首先,您必须使用/etc/my.cnf中的'innodb_force_recovery'指令。 如果您对此不熟悉,请阅读以下文档http://dev.mysql.com/doc/refman/5.0/en/forcing-innodb-recovery.html 。 如果您熟悉,请继续。
有时候,InnoDB只会受到中等程度的损坏,可以自行修复。 将“innodb_force_recovery =#”添加到/etc/my.cnf的[mysqld]部分的新行中。 确保将您所需的恢复幅度更换为#。 如果您尝试使用超过4级的任何东西,那么您将面临进一步腐败的极大风险,这意味着您的时间和精力将无济于事。 在这种情况下,当我们尝试自我修复时,只能使用1或2.一旦你添加了新行,重新启动MySQL服务器并检查日志(/var/lib/mysql/server.hostname.com.err)检查实例是否成功修复。