After the two hosts set up the master-slave replication of MySQL, the show slave status displays: last_ IO_ Error: error connecting to master ……

Last_IO_Error: error connecting to master ‘Replication @vMS00782 :3306’…… Results: Last_IO_Error: error connecting to master’ Replication @vms00782 :3306’……

First, check the error log file of B and find the following errors:
ERROR: Slave I/O: ERROR connecting to master ‘replication @vms00782 :3306’ – retry-time: 60 retry: 2, Error_code: 1045

Then look at the error code from the previous section with Perror:
perror 1045
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 verify on A that the replication user account exists and that the correct permissions have been granted
Mysql> show grants for ‘usvr_replication’@’%’;
+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — +
| Grants for usvr_replication @ %
| + — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — +
| GRANT REPLICATION SLAVE ON *.* TO ‘usvr_replication’@’%’ IDENTIFIED BY PASSWORD ‘*F4039654D0AFD80BB0A7775938EFD47ACB809529’ |
+ — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — +
1 row in the set (0.00 SEC)
No problem found!

Then, try connecting from B to A using this account:
Mysql-uusvr_replication – H 192.168.83.35-P-p55944
Enter the password you set and press enter, not connected!! Enter again, not connected yet!!
It seems that the problem is here, carefully check, the original password was a mistake!

Try to recreate the replication relationship with the correct password:
Execute 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 ok!!

A few points to note:
Use the original password instead of the hashed password in the master_password section of the change master to statement.
Be aware of looking at the error log file in the first place, using the Perror tool to see specific errors based on the error code.

Other FREQUENTLY asked questions:
Mysql fails to start: first look at the error prompted in the error log file, and find the cause according to the error; Check whether the data directory and other configurations in the configuration file are correct; Check whether the owner and group of MySQL related directories are correct; Check to see if any mySQld processes are still running that were not shut down properly.
Mysql cannot connect: first check if the mySQld process is started correctly; See if the provided link string is correct.

Read More: