show slave status\G;
*************************** 1. row ***************************
Slave_IO_State:
Master_Host: 192.168.93.129
Master_User: slave
Master_Port: 3306
Connect_Retry: 10
Master_Log_File: mysql-bin.000029
Read_Master_Log_Pos: 458
Relay_Log_File: wlz-relay-bin.000004
Relay_Log_Pos: 629
Relay_Master_Log_File: mysql-bin.000021
Slave_IO_Running: No
Slave_SQL_Running: No
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 1064
Last_Error: 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 'REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_CONNECTIONS_' at line 1' on query. Default database: 'mysql'. Query: 'GRANT REPLICATION SLAVE ON *.* TO 'repl'@'192.168.93.%' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_USER_CONNECTIONS 0'
Skip_Counter: 0
Exec_Master_Log_Pos: 415
Relay_Log_Space: 8472
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: 13114
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
Last_SQL_Errno: 1064
Last_SQL_Error: 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 'REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_CONNECTIONS_' at line 1' on query. Default database: 'mysql'. Query: 'GRANT REPLICATION SLAVE ON *.* TO 'repl'@'192.168.93.%' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_USER_CONNECTIONS 0'
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
Master_UUID: 3ad0e190-8dad-11e8-aebe-000c29b72aee
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State:
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp: 180825 17:43:40
Last_SQL_Error_Timestamp: 180825 17:43:40
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set:
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name:
Master_TLS_Version:
Master_public_key_path:
Get_master_public_key: 0
1 row in set (0.00 sec)
ERROR:
No query specified
上面是在从服务器上执行 show slave status\G;时出现的错误。原本没有下面的错误
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file'
只有Last_SQL_Errno: 1064这个错误。但是第2个错误百度时找不到答案。后来又遇到了上面那个错误。百度了一下,没想到一并下面的都解决了。
具体步骤是:
#在主数据库端,执行下面的mysql命令:
flush logs;
show master status;
#记下File, Position。
#在从数据库端,执行:
CHANGE MASTER TO MASTER_LOG_FILE='testdbbinlog.000008',MASTER_LOG_POS=107;
#注意上面的testdbbinlog.000008和107是在主数据库执行show master status;查询到的
start slave;
show slave status \G