MySQL報錯 Error_code: 1045
今天把兩臺機器恢復主從關係後,在slave上執行show slave status,結果中顯示
- 2017-04-21T13:46:15.133435Z 8806 [ERROR] Slave I/O for channel '': error connecting to master 'repl@192.168.2.40:3306' - retry-time: 60 retries: 1, Error_code: 1045
首先檢視slave的錯誤日誌檔案,和上面的錯誤一樣
接著用perror檢視上一部獲得的錯誤程式碼:
-
[root@iZ2ze5ifr62amhrpcnpn9yZ mysql]# perror 1045
- MySQL error code 1045 (ER_ACCESS_DENIED_ERROR): Access denied for user '%-.48s'@'%-.64s' (using password: %s)
有可能是複製用的賬戶存在問題,先在MASTER上確認複製使用者賬戶是否存在且是否賦了正確的許可權
-
mysql> show grants for repl@192.168.2.41;
-
+---------------------------------------------------------+
-
| Grants for repl@192.168.2.41 |
-
+---------------------------------------------------------+
-
| GRANT REPLICATION SLAVE ON *.* TO 'repl'@'192.168.2.41' |
-
+---------------------------------------------------------+
- 1 row in set (0.00 sec)
-
[root@iZ2ze5ifr62amhrpcnpn9yZ ~]# mysql -urepl -h 192.168.2.40 -p -P3306
-
Enter password:
- ERROR 1045 (28000): Access denied for user 'repl'@'192.168.2.40' (using password: YES)
-
mysql> update mysql.user set authentication_string=PASSWORD('REPLsafe!@#$41') where User='repl' and host='192.168.2.41';
-
Query OK, 1 row affected, 1 warning (0.00 sec)
-
Rows matched: 1 Changed: 1 Warnings: 1
-
-
mysql> commit;
-
Query OK, 0 rows affected (0.00 sec)
-
-
mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
-
mysql> stop slave;
-
Query OK, 0 rows affected (0.01 sec)
-
-
mysql> change master to
-
-> master_host='192.168.2.40',
-
-> master_port=3306,
-
-> master_user='repl',
-
-> master_password='REPLsafe!@#$41',
-
-> master_log_file='bin.000043',
-
-> master_log_pos=799072709;
-
Query OK, 0 rows affected, 2 warnings (0.05 sec)
-
-
mysql> start slave;
-
Query OK, 0 rows affected (0.01 sec)
-
-
mysql> show slave status \G;
-
*************************** 1. row ***************************
-
Slave_IO_State: Waiting for master to send event
-
Master_Host: 192.168.2.40
-
Master_User: repl
-
Master_Port: 3306
-
Connect_Retry: 60
-
Master_Log_File: bin.000043
-
Read_Master_Log_Pos: 854716379
-
Relay_Log_File: relay.000002
-
Relay_Log_Pos: 1135224
-
Relay_Master_Log_File: bin.000043
-
Slave_IO_Running: Yes
-
Slave_SQL_Running: Yes
-
Replicate_Do_DB:
-
Replicate_Ignore_DB: cus_DEMO,cus_DEMO_0413,cus_DEMO_0414,cus_DEMO_0418
-
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: 800207619
-
Relay_Log_Space: 55644221
-
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: 18559
-
Master_SSL_Verify_Server_Cert: No
-
Last_IO_Errno: 0
-
Last_IO_Error:
-
Last_SQL_Errno: 0
-
Last_SQL_Error:
-
Replicate_Ignore_Server_Ids:
-
Master_Server_Id: 40
-
Master_UUID: 1b00b716-cf6a-11e6-b66e-00163e320583
-
Master_Info_File: mysql.slave_master_info
-
SQL_Delay: 0
-
SQL_Remaining_Delay: NULL
-
Slave_SQL_Running_State: System lock
-
Master_Retry_Count: 86400
-
Master_Bind:
-
Last_IO_Error_Timestamp:
-
Last_SQL_Error_Timestamp:
-
Master_SSL_Crl:
-
Master_SSL_Crlpath:
-
Retrieved_Gtid_Set: 1b00b716-cf6a-11e6-b66e-00163e320583:34573831-34680957
-
Executed_Gtid_Set: 1b00b716-cf6a-11e6-b66e-00163e320583:1-33612321:34573831-34620341
-
Auto_Position: 0
-
Replicate_Rewrite_DB:
-
Channel_Name:
-
Master_TLS_Version:
- 1 row in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20893244/viewspace-2137789/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- mysql報1045錯誤是什麼意思MySql
- Mysql資料庫報ERROR 1045 (28000)報錯及MySQL忘記密碼找回MySql資料庫Error密碼
- mysql登入報錯提示:ERROR 1045 (28000)的解決方法MySqlError
- ERROR 1045 (28000): ProxySQL Error: 報錯ErrorSQL
- MySQL 5.6複製報錯Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;MySqlError
- MySQL 5.7從庫報錯exceeds of slave_pending_jobs_size_max. Error_code: 1864MySqlError
- 報錯”ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO)”Errorlocalhost
- mysql 1045, "Access denied for user 'root'@'localhost' (using password: NO)"MySqllocalhost
- Mysql8.0 報錯MySql
- mysql執行報錯mysql.sockMySql
- 使用Mysql登入時,ERREORE 1045(28000) 解決方法MySql
- mysql登入遇到ERROR 1045問題解決方法MySqlError
- mysql 報錯 Communications link failureMySqlAI
- MySql報錯(持續更新)MySql
- mysql checksum 報錯問題。MySql
- mysql報錯程式碼彙總MySql
- Linux錯誤 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)LinuxErrorlocalhost
- mysqldump Got error: 1045MySqlGoError
- MySQL查詢取別名報錯MySql
- Mysql自動處理同步報錯MySql
- mysql5.6 mysqldump備份報錯MySql
- MySQL更新卡住報錯lock wait timeoutMySqlAI
- mysql 8.0 使用 navicat 登入報錯MySql
- PS1045L-ASEMI超低Low VF肖特基PS1045L
- Mysql報錯注入原理分析(count()、rand()、group by)MySql
- 半同步複製報錯mysql8.0.25MySql
- laravel mysql批量提交報Access denied 錯誤LaravelMySql
- mysql匯入報錯怎麼解決?MySql
- 解決Mysql:ERROR 1045 (28000):Access denied for user ‘root‘@‘localhost‘ (using password: NO)的方法MySqlErrorlocalhost
- 連線MySQL時出現1449與1045異常解決辦法MySql
- 報錯install_driver(mysql) failed: Attempt to reload DBD/mysql.pmMySqlAI
- Navicat連線centos裡mysql報錯Host is not allowed to connect to this MySQL serverCentOSMySqlServer
- 解決MyQL資料庫中1045錯誤的方法——Windows系統(轉)資料庫Windows
- MySQL 8.0.13 密碼問題 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)MySql密碼Errorlocalhost
- Navicat遠端連線MySQL 提示1045 - Access denied for user 'root'@'223.74.158.192'(using password:YES)MySql
- mysql 啟動報錯Can't connect to local MySQL server through socket '/data/mysql/mysql/mysql.sock'(111)MySqlServer
- MYSQL timestamp NOT NULL插入NULL的報錯問題MySqlNull
- MySql報錯:Lock wait timeout exceeded: try restadina transactionMySqlAIREST
- MySQL 啟動報錯 error while loading shared librariesMySqlErrorWhile