[FAQ] DM 同步报错:Access denied for user (MISSING)

【问题澄清】

dm 版本:v1.0.6
无论使用明文密码还是加密密码均报错:

[dm_worker_servers]
dm-worker1 ansible_host=192.168.1.100 source_id=“dm-class” server_id=10086 mysql_host=192.168.1.23 mysql_user=dm-syncer mysql_password=“wYVCZy436CL.xx.xx.” mysql_port=3306 relay_binlog_name=“mysql-bin.009535” deploy_dir=/data1/deploy/dm/dm-worker1

dm-syncer 账号权限如下:

+---------------------------------------------------------------------------------+
| Grants for dm-syncer@%                                                          |
+---------------------------------------------------------------------------------+
| GRANT SELECT, RELOAD, LOCK TABLES, REPLICATION CLIENT ON *.* TO 'dm-syncer'@'%' |
+---------------------------------------------------------------------------------+

dm-worker log 结果如下:

[2020/06/18 09:45:15.597 +08:00] [ERROR] [relay.go:173] ["process error"] [component="relay holder"] [type="msg:\"start reader for UUID 784b7fc9-xx.000001: start sync from GTID set 777234c5-xx:1-37696471,784b7fc9-xx:1-60183626: ERROR 1045 (28000): Access denied for user 'dm-xx'@'%!!(MISSING)'(MISSING) (using password: YES)\" error:<ErrCode:30014 ErrClass:8 ErrScope:1 ErrLevel:3 Message:\"start reader for UUID 784b7fc9-xx.000001: start sync from GTID set 777234c5-xx:1-37696471,784b7fc9-xx:1-60183626: ERROR 1045 (28000): Access denied for user 'dm-xx'@'%!!(MISSING)'(MISSING) (using password: YES)\" RawCause:\"ERROR 1045 (28000): Access denied for user 'dm-xx'@'%' (using password: YES)\" > "]

【解决方案】

针对 dm-syncer 同步用户增加 replica slave 权限,之后同步正常。

【扩展】

  • dm v1.0.6 支持使用 --decrypt 将密文解密成文本
  • mysql 的密码也支持使用明文密码来配置
  • 当前 dm-worker 中对于 mysql_password 没有长度限制

【相关链接】