mysql 错误002061 -身份验证插件'caching_sha2_password'报告错误:身份验证需要安全连接

nwsw7zdq  于 2023-10-15  发布在  Mysql
关注(0)|答案(4)|浏览(206)

RDS上的MySQL版本- 8.0.23我正在将本地数据库复制到AWS RDS MySQL示例。但是我得到了这个错误:

  1. 2021-11-11T22:43:09.091947Z 378 [ERROR] [MY-010584] [Repl] Slave I/O for channel '': error connecting to master 'replicator@localhost:3306' - retry-time: 60 retries: 1 message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection. Error_code: MY-002061

我的RDS从机状态:

  1. *************************** 1. row ***************************
  2. Slave_IO_State: Connecting to master
  3. Master_Host: localhost
  4. Master_User: replicator
  5. Master_Port: 3306
  6. Connect_Retry: 60
  7. Master_Log_File: DESKTOP-7DL3FOM-bin.000010
  8. Read_Master_Log_Pos: 700
  9. Relay_Log_File: relaylog.000001
  10. Relay_Log_Pos: 4
  11. Relay_Master_Log_File: DESKTOP-7DL3FOM-bin.000010
  12. Slave_IO_Running: Connecting
  13. Slave_SQL_Running: Yes
  14. Replicate_Do_DB:
  15. Replicate_Ignore_DB:
  16. Replicate_Do_Table:
  17. Replicate_Ignore_Table: innodb_memcache.cache_policies,innodb_memcache.config_options,mysql.plugin,mysql.rds_configuration,mysql.rds_history,mysql.rds_monitor,mysql.rds_replication_status,mysql.rds_sysinfo
  18. Replicate_Wild_Do_Table:
  19. Replicate_Wild_Ignore_Table:
  20. Last_Errno: 0
  21. Last_Error:
  22. Skip_Counter: 0
  23. Exec_Master_Log_Pos: 700
  24. Relay_Log_Space: 1166
  25. Until_Condition: None
  26. Until_Log_File:
  27. Until_Log_Pos: 0
  28. Master_SSL_Allowed: No
  29. Master_SSL_CA_File:
  30. Master_SSL_CA_Path:
  31. Master_SSL_Cert:
  32. Master_SSL_Cipher:
  33. Master_SSL_Key:
  34. Seconds_Behind_Master: NULL
  35. Master_SSL_Verify_Server_Cert: No
  36. Last_IO_Errno: 2061
  37. Last_IO_Error: error connecting to master 'replicator@localhost:3306' - retry-time: 60 retries: 1 message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.
  38. Last_SQL_Errno: 0
  39. Last_SQL_Error:
  40. Replicate_Ignore_Server_Ids:
  41. Master_Server_Id: 0
  42. Master_UUID:
  43. Master_Info_File: mysql.slave_master_info
  44. SQL_Delay: 0
  45. SQL_Remaining_Delay: NULL
  46. Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
  47. Master_Retry_Count: 86400
  48. Master_Bind:
  49. Last_IO_Error_Timestamp: 211111 23:08:40
  50. Last_SQL_Error_Timestamp:
  51. Master_SSL_Crl:
  52. Master_SSL_Crlpath:
  53. Retrieved_Gtid_Set:
  54. Executed_Gtid_Set:
  55. Auto_Position: 0
  56. Replicate_Rewrite_DB:
  57. Channel_Name:
  58. Master_TLS_Version:
  59. Master_public_key_path:
  60. Get_master_public_key: 0
  61. Network_Namespace:

我试着将我的master db用户密码格式改为mysql native password。但这并没有帮助。我该怎么办才能解决这个问题?

lfapxunr

lfapxunr1#

请使用GET_MASTER_PUBLIC_KEY=1运行更改主命令

cedebl8k

cedebl8k2#

自MySQL Server 8.0.11
caching_sha2_password
用作默认身份验证方法。不过,你可以使用插件
mysql_native_password
用旧方法登录。
更多信息。请浏览此link

rjzwgtxy

rjzwgtxy3#

在mysql复制数据库主/从。我也有一个错误,我忽略了一段时间,像这样

  1. CHANGE MASTER TO GET_MASTER_PUBLIC_KEY=1;
rslzwgfq

rslzwgfq4#

如其他答案中所写,使用GET_MASTER_PUBLIC_KEY=1。完整连接字符串为:

  1. CHANGE REPLICATION SOURCE TO
  2. SOURCE_HOST='master_ip_number',
  3. SOURCE_USER='replica_user',
  4. SOURCE_PASSWORD='p4zzw0rd',
  5. SOURCE_LOG_FILE='binlog.000007',
  6. SOURCE_LOG_POS=7777,
  7. GET_MASTER_PUBLIC_KEY=1;

SOURCE_LOG_FILESOURCE_LOG_POS将通过以下命令从master获取:

  1. SHOW MASTER STATUS;

相关问题