MySQL主從同步錯誤解決和Slave_IO_Running: NO
https://www.linuxidc.com/Linux/2012-03/57708.htm
1蝗茁、出現(xiàn)錯誤提示
Slave I/O: error connecting to master 'backup@192.168.1.x:3306' - retry-time: 60 retries: 86400, Error_code: 1045
**解決方法**
從服務(wù)器上刪除掉所有的二進(jìn)制日志文件,包括一個數(shù)據(jù)目錄下的master.info文件和hostname-relay-bin開頭的文件褪猛。
master.info::記錄了Mysql主服務(wù)器上的日志文件和記錄位置、連接的密碼捞蛋。
2、出現(xiàn)錯誤提示
Error reading packet from server: File '/home/mysql/mysqlLog/log.000001' not found (Errcode: 2) ( server_errno=29)
解決方案:
由于主服務(wù)器運行了一段時間柬姚,產(chǎn)生了二進(jìn)制文件拟杉,而slave是從log.000001開始讀取的,刪除主機(jī)二進(jìn)制文件量承,包括log.index文件搬设。
3、錯誤提示如下
Slave SQL: Error '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 就可以繼續(xù)同步。
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
這個問題原因是,主數(shù)據(jù)庫突然停止或問題終止狮腿,更改了mysql-bin.xxx日志腿宰,slave服務(wù)器找不到這個文件,需要找到同步的點和日志文件缘厢,然后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','無意義回復(fù)',qdir from club.question where id=7330212'
1 row in set (0.00 sec)
這個錯誤就說club.question_del 表里面沒有qdir這個字段 造成的加上就可以了~贴硫!
在主的mysql : 里面查詢 Desc club.question_del椿每;
在 錯誤的從服務(wù)器上執(zhí)行 : alter table question_del add qdir varchar(30) not null;
7、錯誤提示如下
Slave_IO_Running: NO
這個錯誤就是IO 進(jìn)程沒連接上 夜畴,想辦法連接上把 把與主的POS 號和文件一定要對拖刃,然后重新加載下數(shù)據(jù)。具體步驟:
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;
slave start;
問題解決贪绘!
PS: 若你覺得可以兑牡、還行、過得去税灌、甚至不太差的話均函,可以“關(guān)注”一下,就此謝過!