ERROR 1396

APPLIES TO:

mysql> show variables like '%version%';
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 5.7.13 |
| protocol_version | 10 |
| slave_type_conversions | |
| tls_version | TLSv1,TLSv1.1 |
| version | 5.7.13-log |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+------------------------------+

SYMPTOMS

启动 slave 线程后,出现如下错误:

mysql> start slave;
mysql> show slave status\G
Last_Errno: 1396
Last_Error: Error 'Operation CREATE USER failed for 'rep'@'172.17.0.%'' on query. Default database: ''. Query: 'CREATE USER 'rep'@'172.17.0.%' IDENTIFIED WITH 'mysql_native_password' AS '*DF216F57F1F2066124E1AA5491D995C3CB57E4C2''

CASE

无法执行创建用户语句。

SOLUTION

停止 slave 线程。

stop slave;

手动删除该用户。

drop user 'rep'@'172.17.0.%';

重新启动 slave 线程。

start slave;