weixin_54531264 2023-07-25 18:12 采纳率: 62.5%
浏览 15
已结题

mysql主从设置报错

mysql执行完这句命令后报了下面的错误

change master to master_host='192.168.32.129',master_port=3307,master_user='xiaoming',master_password='Root@123456',master_log_file='mysql-bin.000001',master_log_pos=702;



mysql> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Connecting to source
                  Master_Host: 192.168.32.129
                  Master_User: xiaoming
                  Master_Port: 3307
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000001
          Read_Master_Log_Pos: 702
               Relay_Log_File: localhost-relay-bin.000001
                Relay_Log_Pos: 4
        Relay_Master_Log_File: mysql-bin.000001
             Slave_IO_Running: Connecting
            Slave_SQL_Running: Yes
              Replicate_Do_DB: 
          Replicate_Ignore_DB: 
           Replicate_Do_Table: 
       Replicate_Ignore_Table: 
      Replicate_Wild_Do_Table: 
  Replicate_Wild_Ignore_Table: 
                   Last_Errno: 0
                   Last_Error: 
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 702
              Relay_Log_Space: 157
              Until_Condition: None
               Until_Log_File: 
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File: 
           Master_SSL_CA_Path: 
              Master_SSL_Cert: 
            Master_SSL_Cipher: 
               Master_SSL_Key: 
        Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 2061
                Last_IO_Error: Error connecting to source 'xiaoming@192.168.32.129:3307'. This was attempt 3/86400, with a delay of 60 seconds between attempts. Message: Authentication plugin 'caching_sha2_password' reported error: Authentication requires secure connection.
               Last_SQL_Errno: 0
               Last_SQL_Error: 
  Replicate_Ignore_Server_Ids: 
             Master_Server_Id: 0
                  Master_UUID: 
             Master_Info_File: mysql.slave_master_info
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Replica has read all relay log; waiting for more updates
           Master_Retry_Count: 86400
                  Master_Bind: 
      Last_IO_Error_Timestamp: 230725 18:05:09
     Last_SQL_Error_Timestamp: 
               Master_SSL_Crl: 
           Master_SSL_Crlpath: 
           Retrieved_Gtid_Set: 
            Executed_Gtid_Set: 
                Auto_Position: 0
         Replicate_Rewrite_DB: 
                 Channel_Name: 
           Master_TLS_Version: 
       Master_public_key_path: 
        Get_master_public_key: 0
            Network_Namespace: 
1 row in set, 1 warning (0.00 sec)

ERROR: 
No query specified

请问这是什么问题

  • 写回答

2条回答 默认 最新

  • 秋风お亦冷 2023-07-27 14:20
    关注

    这个错误提示说明在连接到主服务器时遇到了身份验证问题。具体来说,这是因为在MySQL 8.0版本及以上,使用了新的默认身份验证插件"caching_sha2_password",而该插件要求使用安全连接(Secure Connection)才能进行身份验证。

    为了解决这个问题,你需要在从服务器上使用SSL/TLS等安全连接方式连接到主服务器,或者修改主服务器上的MySQL配置文件,将默认的身份验证插件改为旧版的插件,例如"mysql_native_password"。具体步骤如下:

    1. 在从服务器上使用SSL/TLS等安全连接方式连接到主服务器。例如,可以在"change master"命令中添加"require ssl"参数,表示需要使用SSL/TLS连接:
    change master to master_host='192.168.32.129',master_port=3307,master_user='xiaoming',master_password='Root@123456',master_log_file='mysql-bin.000001',master_log_pos=702,require ssl;
    
    1. 修改主服务器上的MySQL配置文件,将默认的身份验证插件改为旧版的插件。具体来说,可以在MySQL配置文件中添加以下配置:
    [mysqld]
    default_authentication_plugin=mysql_native_password
    

    修改完成后,重启MySQL服务使配置生效。

    需要注意的是,修改主服务器上的MySQL配置文件可能会影响其他应用程序的正常使用,因此需要谨慎操作。如果不确定如何修改,请咨询数据库管理员或MySQL官方文档。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 8月6日
  • 已采纳回答 7月29日
  • 创建了问题 7月25日

悬赏问题

  • ¥15 关于logstash转发日志时发生的部分内容丢失问题
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?