0%

mysql同步报错

报错1: Error ‘Operation CREATE USER failed for ‘zhangsan’@’%’’ on query

在给用户授权时,mysql出现如下报错:

1
Last_SQL_Error: Error 'Operation CREATE USER failed for 'zahngsan'@'%'' on query. Default database: ''. Query: 'CREATE USER 'zhangsan'@'%' IDENTIFIED BY PASSWORD '*2F7A17C3E76FB561456B2111C0E78CFB5E5030A5''

这个报错的原因可能是由于:(1)已创建过该用户 (2)已有该用户的授权信息

解决方法:

删除此用户,刷新,并重启slave

1
2
3
4
5
6
7
8
9
10
11
12
#删除该用户
mysql> drop user 'zhangsan'@'%';

mysql> FLUSH PRIVILEGES;

# 重启同步
mysql> stop slave;

mysql> start slave;

# 最后查看是否同步正常
mysql> show slave status\G
------------- 本文结束 感谢您的阅读-------------