After MySQL master-slave replication is built on the two hosts, the showslavestatus displays: Last_IO_Error: errorconnectingtomaster ...... Solve bitsCN.com
After MySQL master-slave replication is built on the two hosts, the show slave status displays: Last_IO_Error: error connecting to master ...... Solution
Run show slave status on the server load balancer after the master-slave mysql replication relationship is set up for both hosts A and B (master for A and slave for B). The result shows Last_IO_Error: error connecting to master 'replication @ VMS00782: 8080 '......
First, check the error log file of B and find the following error:
ERROR] Slave I/O: error connecting to master 'replication @ VMS00782: 8080'-retry-time: 60 retries: 2, Error_code: 3306
Then, use perror to view the error code obtained in the previous step:
Perror1045
Output:
MySQL error code 1045 (ER_ACCESS_DENIED_ERROR): Access denied for user '%-.48s'@'%-.64s' (using password: %s)
Is there a problem with the account used for copying ?? First, check whether the copied user account exists and has been granted correct permissions on account.
mysql> show grants for 'usvr_replication'@'%';+-----------------------------------------------------------------------------------------------------------------------------+| Grants for usvr_replication@% |+-----------------------------------------------------------------------------------------------------------------------------+| GRANT REPLICATION SLAVE ON *.* TO 'usvr_replication'@'%' IDENTIFIED BY PASSWORD '*F4039654D0AFD80BB0A7775938EFD47ACB809529' |+-----------------------------------------------------------------------------------------------------------------------------+1 row in set (0.00 sec)
No problem found!
Then, try to use this account from B to connect to:
mysql -uusvr_replication -h 192.168.83.35 -p -P55944
Enter the set password and press Enter. the password is not connected !!! Enter again, not connected !!!
It seems that the problem is here. check it carefully. it turns out that the password is wrong!
Try to use the correct password to recreate the replication relationship:
Run the following command on B:
mysql>stop slave;mysql>researt slave;mysql>change master to master_host = 'VMS00782',master_user = 'replication',master_password = 'ReplPass@123456',master_port = 3306,master_log_file = 'VMS00782-bin.000001',master_log_pos = 120;mysql>start slave;mysql>show slave status;
Everything is normal !!!
Notes:
Use the original password instead of the hash password in the master_password section of the change master to statement.
Note that you can use the perror tool to view specific errors in the error code as soon as possible.
Other frequently asked questions:
Mysql cannot be started: First check the errors in the error log file. locate the cause based on the error. check whether the data directory and other configurations in the configuration file are correct. check whether the MySQL Directory owner and group are correct; check whether any mysqld process that has not been properly closed is still running.
Mysql cannot be connected: Check whether the mysqld process is correctly started and whether the provided connection string is correct.
BitsCN.com