接上篇,上次错误原因是由于用户或者密码错误,此次模拟另外一个错误。
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
mysql> show slave status\G *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 192.168.199.177 Master_User: byrd Master_Port: 3306 Connect_Retry: 60 Master_Log_File: mysql-bin.000018 Read_Master_Log_Pos: 3487 Relay_Log_File: mysqld-relay-bin.000073 Relay_Log_Pos: 517 Relay_Master_Log_File: mysql-bin.000018 Slave_IO_Running: Yes Slave_SQL_Running: No Replicate_Do_DB: Replicate_Ignore_DB: Replicate_Do_Table: Replicate_Ignore_Table: Replicate_Wild_Do_Table: Replicate_Wild_Ignore_Table: mysql.%,hitest.% Last_Errno: 1007 Last_Error: Error 'Can't create database 'zhangfei'; database exists' on query. Default database: 'zhangfei'. Query: 'create database zhangfei' Skip_Counter: 0 Exec_Master_Log_Pos: 3381 Relay_Log_Space: 797 Until_Condition: None Until_Log_File: Until_Log_Pos: 0 Master_SSL_Allowed: No Master_SSL_CA_File: Master_SSL_CA_Path: Master_SSL_Cert: Master_SSL_Cipher: Master_SSL_Key: Seconds_Behind_Master: NULL Master_SSL_Verify_Server_Cert: No Last_IO_Errno: 0 Last_IO_Error: Last_SQL_Errno: 1007 Last_SQL_Error: Error 'Can't create database 'zhangfei'; database exists' on query. Default database: 'zhangfei'. Query: 'create database zhangfei' Replicate_Ignore_Server_Ids: Master_Server_Id: 1 Master_UUID: 8419092a-d274-11e3-9f33-00155dc7834b Master_Info_File: /usr/local/mysql/data/master.info SQL_Delay: 0 SQL_Remaining_Delay: NULL Slave_SQL_Running_State: Master_Retry_Count: 86400 Master_Bind: Last_IO_Error_Timestamp: Last_SQL_Error_Timestamp: 140712 17:15:46 Master_SSL_Crl: Master_SSL_Crlpath: Retrieved_Gtid_Set: Executed_Gtid_Set: Auto_Position: 0 1 row in set (0.00 sec) |
报错内容:“Error 'Can't create database 'zhangfei'; database exists' on query. Default database: 'zhangfei'. Query: 'create database zhangfei'”,由于从库已经有了一个叫zhangfei的数据库,而主库又建立了一个叫zhangfei的数据库,由此导致的错误。
修复方式一:
0 1 2 |
mysql> stop slave; mysql> set global sql_slave_skip_counter = 1; mysql> start slave; |
修复方式二:
0 1 |
[root@Slave-Mysql data]# grep slave-skip-errors /etc/my.cnf slave-skip-errors = 1032,1062,1007 #Last_SQL_Error错误代码集 |
slave-skip-errors = 1032,1062,1007 #错误代码说明SourceByrd's Weblog-https://note.t4x.org/error/cant-create-database/
申明:本文由BYRD原创(基于Mysql5.6.16),未经许可禁止转载!SourceByrd's Weblog-https://note.t4x.org/error/cant-create-database/
参考:http://dev.mysql.com/doc/refman/5.0/en/set-global-sql-slave-skip-counter.htmlSourceByrd's Weblog-https://note.t4x.org/error/cant-create-database/ SourceByrd's Weblog-https://note.t4x.org/error/cant-create-database/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!