`
wenson
  • 浏览: 1039865 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

mysql从服务器出现的错误解決方法:Slave_SQL_Running: No(主-从)

阅读更多

1、出现错误提示、

 

 

Slave I/O: error connecting to master 'backup@192.168.1.x:3306' - retry-time: 60  retries: 86400, Error_code: 1045

 

解决方法

从服务器上删除掉所有的二进制日志文件,包括一个数据目录下的master.info文件和hostname-relay-bin开头的文件

master.info:记录了Mysql主服务器上的日志文件和记录位置、连接的密码

 

 2、出现错误提示

 

 

Error reading packet from server: File '/home/mysql/mysqlLog/log.000001' not found (Errcode: 2) ( server_errno=29)

 

解决方案:

由于主服务器运行了一段时间,产生了二进制文件,而slave是从log.000001开始读取的,删除主机二进制文件,包括log.index文件。

3、错误提示如下

 

 

Slave SQLError 'Table 'xxxx' doesn't exist' on query. Default database: 't591'. Query: 'INSERT INTO `xxxx`(type,post_id,browsenum) SELECT type,post_id,browsenum FROM xxxx WHERE hitdate='20090209'', Error_code: 1146

 

解决方法

由于slave没有此table表,添加这个表,使用slave start 就可以继续同步。

 

 

4、错误提示如下

 

 

Error 'Duplicate entry '1' for key 1' on query. Default database: 'movivi1'. Query: 'INSERT INTO `v1vid0_user_samename` VALUES(null,1,'123','11','4545','123')'

 

 

Error 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1' on query. Default database: 'club'. Query: 'INSERT INTO club.point_process ( GIVEID, GETID, POINT, CREATETIME, DEMO ) VALUES ( 0, 4971112, 5, '2010-12-19 16:29:28','

1 row in set (0.00 sec)

 

 

 

 Mysql > Slave status\G;

显示:Slave_SQL_Running 为 NO

解决方法:

Mysql > stop slave;

Mysql > set global sql_slave_skip_counter =1 ;

Mysql > start slave;

5、错误提示如下

# show slave status\G;

 

 

Master_Log_File: mysql-bin.000029

Read_Master_Log_Pos: 3154083

Relay_Log_File: c7-relay-bin.000178

Relay_Log_Pos: 633

Relay_Master_Log_File: mysql-bin.000025

Slave_IO_Running: Yes

Slave_SQL_Running: No

Replicate_Do_DB: club

Replicate_Ignore_DB: 

Replicate_Do_Table: 

Replicate_Ignore_Table: 

Replicate_Wild_Do_Table: 

Replicate_Wild_Ignore_Table: 

Last_Errno: 1594

Last_Error: Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MySQL code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.

Skip_Counter: 0

Exec_Master_Log_Pos: 1010663436

 

这个问题原因是,主数据库突然停止或问题终止,更改了mysql-bin.xxx日志,slave服务器找不到这个文件,需要找到同步的点和日志文件,然后chage master即可。

解决方法:

 

 

 change master to 

 master_host='211.103.156.198',

 master_user='同步帐号', 

 master_password='同步密码', 

 master_port=3306, 

 master_log_file='mysql-bin.000025', 

 master_log_pos=1010663436;

 

6、错误提示如下

 

 

Error 'Unknown column 'qdir' in 'field list'' on query. Default database: 'club'. Query: 'insert into club.question_del (id, pid, ques_name, givepoint, title, subject, subject_pid, createtime, approve, did, status, intime, order_d, endtime,banzhu_uid,banzhu_uname,del_cause,qdir) select id, pid, ques_name, givepoint, title, subject, subject_pid, createtime, approve, did, status, intime, order_d, endtime,'1521859','admin0523','无意义回复',qdir from club.question where id=7330212'

1 row in set (0.00 sec)

 

这个错误就说club.question_del 表里面没有qdir这个字段 造成的加上就可以了~

在主的mysql : 里面查询 Desc club.question_del; 

 错误的从服务器上执行 : alter table question_del add qdir varchar(30) not null;

 7、错误提示如下

  Slave_IO_Running: NO

 这个错误就是IO 进程没连接上  ,想办法连接上把 把与主的POS 号和文件一定要对,然后重新加载下数据。具体步骤:

slave stop;
change master to master_host='IP地址',master_user='club',master_password='mima ',master_log_file='mysqld-bin.000048',MASTER_LOG_POS=396549485;
注:master_log_file='mysqld-bin.000048',MASTER_LOG_POS=396549485;是从主的上面查出 来的 :show master status\G;

LOAD DATA FROM MASTER; 

load data from master;

slave start;

 

问题解决!

 

本文出自 “学习要永恒” 博客,请务必保留此出处http://hzcsky.blog.51cto.com/1560073/479476

分享到:
评论

相关推荐

    mysql 主从数据不一致,提示: Slave_SQL_Running: No 的解决方法

    本文实例讲述了mysql 主从数据不一致,提示: Slave_SQL_Running No 的解决方法。分享给大家供大家参考,具体如下: 在slave服务器上通过如下命令 mysql> show slave status\G; 显示如下情况: Slave_IO_Running: ...

    MYSQL同步 Slave_IO_Running: No 或者Slave_SQL_Running: No的解决方法[已测]

    今天在测试mysql是否同步时,检查数据库发现一台MySQL Slave未和主机同步,查看Slave状态: mysql> show slave status\G Slave_IO_Running: Yes Slave_SQL_Running: No Last_Errno: 1062 …. Seconds_Behind_Master:...

    MySQL-Master_Slave_repl.txt

     Slave_SQL_Running: Yes It means that it was successful.     Errors in the whole process: Slave_IO_Running: Connecting 1. Mine is the wrong host ip. 2. There are still some firewalls on the ...

    mysql 数据同步 出现Slave_IO_Running:No问题的解决方法小结

    下面写一下,这两个要是有no了,怎么恢复。。 如果是slave_io_running no了,那么就我个人看有三种情况,一个是网络有问题,连接不上,像有一次我用虚拟机搭建replication,使用了nat的网络... 如果是slave_sql_running

    Mysql主从复制Slave_IO_Running: No解决

    mysql> show master status; +------------------+----------+--------------+--------------------------+-------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set | +----...

    关于MySQL中savepoint语句使用时所出现的错误

    前几天帮同事解决一个案例,在主从复制环境下,从库上的MySQL版本号是5.5.5,遇到下面的错误: #其他非相关信息我都隐藏掉了 [(yejr@imysql.com)]> show slave status \G; Slave_IO_Running: Yes Slave_SQL_...

    mysql主从配置与安装

    带着喜悦的心情来和大家分享;在网上找了N篇mysql主从配置文章,都是有点小问题,不过还好,综合起来,总算让我给配置出来了,真心和大家分享,... 如果Slave_IO_Running、Slave_SQL_Running状态为Yes则表明设置成功。

    MySQL主从复制配置心跳功能介绍

    在 MySQL 主从复制时,有时候会碰到这样的故障:在 Slave 上 Slave_IO_Running 和 Slave_SQL_Running 都是 Yes,Slave_SQL_Running_State 显示 Slave has read all relay log; waiting for the slave I/O thread to ...

    MYSQL主从不同步延迟原理分析及解决方案

    得从mysql的数据库主从复制原理说起,mysql的主从复制都是单线程的操作,主库对所有DDL和DML产生binlog,binlog是顺序写,所以效率很高,slave的Slave_IO_Running线程到主库取日志,效率很比较高,下一步,问题来了...

    服务器调试文档.doc

    如果slave_SQL_Running提示为NO,请等待10-20分钟后再次输入"show slave status\G;〞查看是否同步成功;若仍不成功,请检查之前操作是否存在问题. 8. 如果显示slave_IO_Running为NO,请重置同步〔先stop slave; 在...

    CentOS服务器平台搭建mysql主从复制与读写分离的方法

    本文实例讲述了CentOS服务器搭建mysql主从复制与读写分离的方法。分享给大家供大家参考,...② 从库Slave_IO_Running:NO 可能原因:帐号无权限操作 ③ Can’t execute the query because you have a conflicting read

    zabbix监控MySQL主从状态的方法详解

    一般情况下,在MySQL的从上查看从的运行状态是通过Slave_IO_Running线程和Slave_SQL_Running线程是否ok,通过命令“show slave status\G;”即可查看。所以这里根据这两个值进行判断。 agent端脚本编写及配置 说明:...

    基于MySQL的数据库中间件Meituan-DBProxy.zip

    thread-running-sleep-delay用于指定在thread running数超过backend-max-thread-running时,客户端连接等待的时间 添加到黑名单中需要满足两个条件:SQL执行的时间和频率 提供了查看、修改、添加...

Global site tag (gtag.js) - Google Analytics