您的位置:首页 > 数据库 > MySQL

mysql数据库重启失败,报错Binlog has bad magic number

2015-10-13 16:20 1666 查看
我的数据库版本是5.1.44,操作系统是redhat

今天启动数据报错,下面是错误日志,谁能帮忙看看,谢谢了

100316 10:58:47 mysqld_safe
Starting mysqld daemon with databases from /var/lib/mysql

100316 10:58:48 [Note] Plugin 'FEDERATED' is disabled.

100316 10:58:49 InnoDB: Started; log sequence number 6 4161791115

100316 10:58:49 [ERROR] Binlog has bad magic number; It's not a binary log file that can be used by this version of MySQL

100316 10:58:49 [ERROR] Can't init tc log

100316 10:58:49 [ERROR] Aborting

100316 10:58:49 InnoDB: Starting shutdown...

100316 10:58:54 InnoDB: Shutdown completed; log sequence number 6 4161791115

100316 10:58:54 [Note] /usr/sbin/mysqld: Shutdown complete

100316 10:58:54 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended

100316 10:59:57 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

100316 10:59:57 [Note] Plugin 'FEDERATED' is disabled.

100316 10:59:58 InnoDB: Started; log sequence number 6 4161791115

100316 10:59:58 [ERROR] Binlog has bad magic number; It's not a binary log file that can be used by this version of MySQL

100316 10:59:58 [ERROR] Can't init tc log

100316 10:59:58 [ERROR] Aborting

100316 10:59:58 InnoDB: Starting shutdown...

100316 11:00:03 InnoDB: Shutdown completed; log sequence number 6 4161791115

100316 11:00:03 [Note] /usr/sbin/mysqld: Shutdown complete

100316 11:00:03 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended

=================解决方案=====================

问题解决了,

檢查後依然不能開始MySQL 服務器 ……

打開 /var/log/syslog 看看有沒有以下一行

Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]: ^G/usr/bin/mysqladmin: connect to server at ‘localhost’ failed

Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]: error: ‘Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)’

Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]: Check that mysqld is running and that the socket: ‘/var/run/mysqld/mysqld.sock’ exists!

Feb 26 20:45:59 Yubis-production /etc/init.d/mysql[6254]:

Feb 26 20:46:04 Yubis-production mysqld_safe[6319]: started

Feb 26 20:46:04 Yubis-production mysqld[6328]: 090226 20:46:04 InnoDB: Started; log sequence number 0 43665

Feb 26 20:46:04 Yubis-production mysqld[6328]: 090226 20:46:04 [ERROR] Binlog has bad magic number; It’s not a binary log file that can be used by this version of MySQL

如果存在的話, 應該是你的 MySQL 服務器沒有正常關上, 那就 …

打開 /var/log/mysql

keithyau@Yubis-production:/var/lib$ sudo ls -l /var/log/mysql/

total 295696

-rw-rw—- 1 mysql adm 104885450 2009-02-18 12:36 mysql-bin.000077

-rw-rw—- 1 mysql adm 105175310 2009-02-24 11:27 mysql-bin.000078

-rw-rw—- 1 mysql adm 83164522 2009-02-26 19:24 mysql-bin.000079

-rw-rw—- 1 mysql adm 98 2009-02-26 19:56 mysql-bin.000080

-rw-rw—- 1 mysql adm 9233377 2009-02-27 16:10 mysql-bin.000081

-rw-rw—- 1 mysql adm 160 2009-02-26 21:08 mysql-bin.index

把最後一個 bin 檔案刪除

sudo rm /var/log/mysql/mysql-bin.00081

再打開 mysql-bin.index 把最後一行刪除

sudo vi /var/log/mysql/mysql-bin.index

/var/log/mysql/mysql-bin.000077

/var/log/mysql/mysql-bin.000078

/var/log/mysql/mysql-bin.000079

/var/log/mysql/mysql-bin.000080

/var/log/mysql/mysql-bin.000081

重新打開 MySQL 資料庫就完成了

Sudo /etc/init.d/mysql restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: