一、背景:
从数据库报错、或者误删sql、无法正常从主库同步数据,举例如下:
MariaDB [test]> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.10.135
Master_User: jfedu-cong2
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: jfedu-zhu2.000005
Read_Master_Log_Pos: 446
Relay_Log_File: mariadb-relay-bin.000022
Relay_Log_Pos: 747
Relay_Master_Log_File: jfedu-zhu2.000004
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:
Last_Errno: 1062
Last_Error: Error 'Duplicate entry '1' for key 'PRIMARY'' on query. Default database: 'zabbix'. Query: 'INSERT INTO auditlog (userid,clock,ip,action,resourcetype,details,auditid) VALUES ('1','1619014990','192.168.10.1','3','0','Login failed.','1