<!-- flowchart 箭头图标 勿删 -->
<svg style="display: none;">
<path d="M5,0 0,2.5 5,5z" id="raphael-marker-block" stroke-linecap="round" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path>
</svg>
<p>转自:<a data-token="8a905b11f0235b05976efe8f96ced5c4" href="http://blog.51cto.com/loose/1224564" rel="nofollow">http://blog.51cto.com/loose/1224564</a><br>
1 、出现错误提示<br>
Slave I/O: error connecting to master ‘backup@192.168.0.x:3306’ -retry-time: 60 retries: 86400,Error_code: 1045</p>
<h2><a id="masterinfohostname_relaybin__ masterinfo_Mysql_ rm_rf__4"></a>解决方法:<br>
从服务器上删除掉所有的二进制日志文件,包括一个数据目录下的master.info文件和hostname -relay-bin 开头的文件 。<br>
<a data-token="eec8a53ee0b70884c62966f662735892" href="http://master.info" rel="nofollow">master.info</a>: 记录了Mysql主服务器上的日志文件和记录位置、连接的密码 。<br>
#rm -rf <em>.</em></h2>
<p>2 、出现错误提示<br>
Error reading packet from server: File ‘/home/mysql/mysqlLog/log.000001’ not found (Errcode: 2) (server_errno=29)</p>
<h2><a id="slavelog000001logindex_12"></a>解决方法:<br>
由于主服务器运行了一段时间,产生了二进制文件,而slave是从log.000001开始读取的,删除主机二进制文件,包括log.index文件。</h2>
<p>3 、错误提示如下<br>
Slave SQL: Error ‘Table ‘xxxx’ doesn’t exist’ on query. Default database: ‘t591’. Query: ‘INSERT INTO <code>xxxx</code>(type,post_id,browsenum) SELECT type,post_id,browsenum FROM xxxx WHERE hitdate=‘20090209’’, Error_code: 1146</p>
<h2><a id="slavetableslave_start_18"></a>解决方法:<br>
由于slave没有此table表,添加这个表使用slave start就可以继续同步。</h2>
<p>4 、错误提示如下<br>
Error ‘Duplicate entry ‘1’ for key 1’ on query. Default database: ‘movivi1’. Query: ‘INSERT INTO <code>v1vid0_user_samename</code> VALUES(null,1,‘123’,‘11’,‘4545’,‘123’)’</p>
<p>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’, ’<br>
1 row in set (0.00 sec)</p>
<h2><a id="Mysql_Slave_statusG Slave_SQL_RunningNO Mysql_stop_slave Mysql_set_global_sql_slave_skip_counter_1_ Mysql_start_slave_27"></a>Mysql> Slave status\G;<br>
显示:Slave_SQL_Running为NO<br>
解决方法:<br>
Mysql> stop slave;<br>
Mysql> set global sql_slave_skip_counter =1 ;<br>
Mysql> start slave;</h2>
<p>5 、错误提示如下</p>
<h1><a id="show_slave_statusG_35"></a>show slave status\G;</h1>
<p>Master_Log_File: mysql-bin.000029<br>
Read_Master_Log_Pos: 3154083<br>
Relay_Log_File: c7-relay-bin.000178<br>
Relay_Log_Pos: 633<br>
Relay_Master_Log_File: mysql-bin.000025<br>
Slave_IO_Running: Yes<br>
Slave_SQL_Running: No<br>
Replicate_Do_DB: club<br>
Replicate_Ignore_DB:<br>
Replicate_Do_Table:<br>
Replicate_Ignore_Table:<br>
Replicate_Wild_Do_Table:<br>
Replicate_Wild_Ignore_Table:<br>
Last_Errno: 1594<br>
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.<br>
Skip_Counter: 0<br>
Exec_Master_Log_Pos: 1010663436</p>
<p>这个问题原因是,主数据库突然停止或问题终止,更改了mysql-bin.xxx日志,slave服务器找不到这个文件,需要找到同步的点和日志文件,然后chage master即可。<br>
解决方法:</p>
<h2><a id="change_master_to_ _master_host19216801 _master_user_ _master_password_ _master_port3306_ _master_log_filemysqlbin000002_ _master_log_pos106_58"></a>change master to<br>
master_host=‘192.168.0.1’,<br>
master_user=‘同步帐号’,<br>
master_password=‘同步密码’,<br>
master_port=3306,<br>
master_log_file=‘mysql-bin.000002’,<br>
master_log_pos=106;</h2>
<p>6 、错误提示如下</p>
<p>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’<br>
1 row in set (0.00 sec)</p>
<h2><a id="_clubquestion_del___qdir____ mysql__Desc_club_question_del__ alter_table_question_del_add_qdir_varchar30_not_null_71"></a>这个错误就说 club.question_del 表里面没有 qdir 这个字段 造成的加上就可以了 ~ !<br>
在主的mysql:里面查询 Desc club. question_del ;<br>
在错误的从 |
|