mysql不工作,它没有启动

时间:2016-04-22 05:21:51

标签: mysql xampp

这里有一些错误日志。

160422 10:45:00 [Note] InnoDB: The log sequence numbers 1665244 and 1665244   in ibdata files do not match the log sequence number 15857945 in the ib_logfiles!
160422 10:45:00 [Note] InnoDB: Database was not shutdown normally!
160422 10:45:00 [Note] InnoDB: Starting crash recovery.
160422 10:45:00 [Note] InnoDB: Reading tablespace information from the .ibd files...
160422 10:45:00 [Note] InnoDB: Restoring possible half-written data pages 
160422 10:45:00 [Note] InnoDB: from the doublewrite buffer...
160422 10:45:00 [Note] InnoDB: 128 rollback segment(s) are active.
160422 10:45:00 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.22-72.0 started; log sequence number 15857945
160422 10:45:00 [Note] InnoDB: !!! innodb_force_recovery is set to 2 !!!
160422 10:45:00 [Note] Plugin 'FEEDBACK' is disabled.
160422 10:45:00 [Note] Server socket created on IP: '::'.
160422 10:45:00 [ERROR] mysqld.exe: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
160422 10:45:00 [ERROR] Fatal error: Can't open and lock privilege tables: Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed
pz有人帮忙,我有一个重要的数据库,其备份我还没有,我早些时候发布了这个问题,但没有得到答案...这开始时我试图访问phpmyadmin,从那时起mysql不是开始。

2 个答案:

答案 0 :(得分:0)

我看到了两种可能的方法。

对于以下内容:

Table '.\mysql\db' is marked as crashed and last (automatic?) repair failed

如果它是MyISAM数据库,您可以使用mysqlcheck进行修复。如果它是InnoDB数据库,请尝试使用InnoDB强制恢复选项。您可以使用InnoDB强制恢复启动数据库,并从中获取数据库转储,以便在新的MySQL安装上恢复它。

将来,请尝试启用innodb_file_per_table选项。

现在,第二个选项。即使第一个看起来很可能。

The log sequence numbers 1665244 and 1665244   in ibdata files do not match the log sequence number 15857945 in the ib_logfiles!

如果第一种方法不起作用,请尝试一下。看起来ib_logfiles已损坏,我之前遇到过这个问题,并使用以下步骤让我的数据库启动并运行:

  1. 在另一个目录中完整备份mysql datadir。
  2. 确保mysql服务已停止。
  3. 删除ib_logfile1和ib_logfile2
  4. 启动MySQL服务
  5. 希望有所帮助

答案 1 :(得分:0)

Rishav,innodb_force_recovery没有恢复任何东西。这是你启动mysql的一种模式。一旦启动,您应该能够进行转储。以下应该是步骤:

重新启动它的步骤。

1. Stop mysqld.
2. Backup /var/lib/mysql/ib*
3. Add the following line into /etc/my.cnf
innodb_force_recovery = 4
4. Restart mysqld.
5. Dump your DB using mysqldump to a dump.sql file.
6. Drop all databases which need recovery.
7. Stop mysqld.
8. Remove /var/lib/mysql/ib*
9. Comment out innodb_force_recovery in /etc/my.cnf
10. Restart mysqld. Look at mysql error log. By default it should be /var/lib/mysql/server/hostname.com.err to see how it creates new ib* files. (Although, I recommend a fresh setup here)
11. Restore databases from the dump:mysql < dump.sql