After two hosts build MySQL master-slave replication, show slave status shows: Last_io_error:error Connecting to master ...

Source: Internet
Author: User

After two hosts A and B build the MySQL master-slave copy relationship (A is master,b to slave), the show slave status is executed on slave, and the results show last_io_error:error connecting to Master ' [ Email protected]:3306 ' ...

First, look at the error log file for B, and find the following error:

ERROR] Slave I/o: Error connecting to master ' [email protected]:3306 '-retry-time:60 retries:2, error_code:1045

Then use Perror to view the error code obtained from the previous section:

Perror 1045

Output: MySQL error code 1045 (er_access_denied_error): ACCESS DENIED for user '%-.48s ' @ '%-.64s ' (using password:%s)

Is there a problem with the duplicate account?? First verify that the replication user account exists and that the correct permissions are assigned on a

 mysql> show grants for ' usvr_replication ' @ '% ';
+---------------------------------------------------------------------------------------------------------- -------------------+
| Grants for [email protected]%                         &NB Sp                          ,         &NB Sp                                 |
+---------------------------------------------------------------------------------------------------------- -------------------+
| GRANT REPLICATION SLAVE on *. * to ' usvr_replication ' @ '% ' identified by PASSWORD ' * f4039654d0afd80bb0a7775938efd47acb809529 ' |
+---------------------------------------------------------------------------------------------------------- -------------------+
1 row in Set (0.00 sec)

Found no problem!

Then, try using the account from B to connect to a:

Mysql-uusvr_replication-h 192.168.83.35-p-p55944

Enter the password of the set after the return, not connected!!! Input again, not connected!!!

It seems that the problem is here, careful examination, the original password is wrong!

Try rebuilding 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 = ' [email protected] ',
Master_port = 3306,
Master_log_file = ' vms00782-bin.000001 ',
Master_log_pos = 120;
Mysql>start slave;
mysql>show slave status;

Everything is OK!!!

Several issues to be aware of:

Use the original password instead of the hashed password in the Master_password section of the change master to statement.

Note When viewing the error log file at the first time, you can use the Perror tool to view specific errors based on the error code.

Several other FAQs:

MySQL does not start: First look at the error log file prompts for the error, based on the error to find the reason, see the configuration file data directory, such as the correct configuration, check the MySQL related directory is the owner and the group is correct; see if there are mysqld processes that were not properly closed before are still running.

MySQL is unable to connect: first see if the mysqld process started correctly, and then see if the connection string provided is correct.

Reprint: http://blog.csdn.net/zyz511919766/article/details/12753025

After two hosts build MySQL master-slave replication, show slave status shows: Last_io_error:error Connecting to master ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.