Home > Database > Mysql Tutorial > MySQL主从同步遇到的错误及解决

MySQL主从同步遇到的错误及解决

WBOY
Release: 2016-06-07 17:10:57
Original
1144 people have browsed it

MySQL数据库主从同步做了有1年,期间遇到一些错误,自己查资料摸索解决 和大家分享一下 1 如果:Slave_IO_Running=NO,Slave_SQL

MySQL数据库主从同步做了有1年,期间遇到一些错误,自己查资料摸索解决
和大家分享一下

1 如果:Slave_IO_Running=NO,Slave_SQL_Running=YES,Last_Errno=0
mysql> slave stop ;
mysql> slave start;
mysql> show slave status ;
如果Slave_IO_Running=YES,Slave_SQL_Running=YES,Last_Errno=0
那么,数据库的replication已经成功启动。

2 如果提示有duplicated数据,,直接delete那条数据之后的,然后
mysql> slave stop ;
mysql> slave start;
mysql> show slave status ;
如果Slave_IO_Running=YES,Slave_SQL_Running=YES,Last_Errno=0
那么,数据库的replication已经成功启动。

3 如果还不行,查看错误日志,看看是卡在那个binlog上了,比如 : 卡在000079
则:
SLAVE STOP;
CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000080', MASTER_LOG_POS=0;
SLAVE START;


4 如果错误提示: [mysql]Table tblName is marked as crashed and should be repaired
Mysql提示tblName表格已损坏,需要修复,解决方法:
进入到对应的数据库目录:
cd /var/lib/mysql/dbname
使用myisamchk修复:
shell> myisamchk -r tblName
如果提示failed
shell> myisamchk -f tblName
强制修复
恢复时间比较长,耐心等待修复完成
然后重启mysql就行

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template