Skip to content

Instantly share code, notes, and snippets.

@aamsur-mkt
Created October 16, 2020 08:50
Show Gist options
  • Save aamsur-mkt/75a4145e7619f906eff08b55ac7a95cf to your computer and use it in GitHub Desktop.
Save aamsur-mkt/75a4145e7619f906eff08b55ac7a95cf to your computer and use it in GitHub Desktop.
Skip Myqsl Slave Query
Sometime we will see an error like
```bash
Replication reported error 1396:
Error 'Operation ALTER USER failed for 'dba1'@'localhost'' on query.
Default database: 'mysql'.
Query: 'ALTER USER 'dba1'@'localhost' IDENTIFIED WITH 'mysql_native_password' AS '*DAB3A57F75AD41285552E115420DA2EFD756CD19''
```
I will skip that query which makes our slave server stuck.
Use the below command to fix.
```bash
Stop slave;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1; START SLAVE;
```
If you want to exclude this error all time, add the below line in my.cnf file.
If the error code is `1396` then
```bash
slave-skip-errors = 1396
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment