Configure master-slave mysql for one cp and two MySQL instances in Windows 7

Source: Internet
Author: User
Configure master/slave bitsCN.com for one cp mysql in Windows 7
Environment: personal pc Windows 7 one; use: Official Download: mysql-noinstall-5.5.11-win32.zip 1. decompress the package to 2 (folders) mysql_master (master) mysql_slave (slave) 2. configuration file modify master server configuration change mysql_master/my-huge.ini change name to my. ini modified my. [client] port = 3306 [mysqld] server-id = 1 port = 3306 binlog-do-db = test # synchronize test in the ini file. if this function is disabled, that is, except for not allowed, all other databases are synchronized. Binlog-ignore-db = backup does not synchronize the backup database, the following is the same as binlog-ignore-db = mysql binlog-ignore-db = information_schema log-bin = mysql-bin start the mysql-5.1.36-win32_1/bin/mysqld.exe use the master mysql-u root to create a synchronization role mysql> grant replication slave, RELOAD, super on *. * TO backupuser @ '2017. 0.0.1 'identified BY '000000'; mysql> show master status; + -------------------- + ---------------- + -------------------- + | File | Position | Binlo G_Do_DB | rows | + rows + ---------- + -------------- + ------------------ + | mysql-bin.000001 | 106 | test | backup | + backups + ---------- + -------------- + ------------------ + 1 row in set (0.00 sec) here, the file and position will be used in the slave database. Slave server configuration: mysql-5.1.36-win32_2/my-huge.ini change name to my. ini modified my. the [client] # password = your_password port = 3307 socket =/tmp/mysql. sock # Here follows entries for some specific programs # The MySQL server [mysqld] server-id = 2 master-host = 127.0.0.1 master-user = backup master-password = 123456 master-port = 3306 port = 3307 start mysql-5.1.36-win32_2/bin/mysqld.exe what I encountered at that time was not started successfully, view error logs [ERROR] d:/mysql_slave/bin/mysqld found: unknown variable 'master-host = 127.0.0.1 'and then comment out the following four lines: master-host = 127.0.0.1 master-user = backup master-password = 1234 master-port = 3307 and then execute the following command. Slave stop; change master to master_host = '2017. 0.0.1 ', master_user = 'backup', master_password = '000000', master_log_file = 'MySQL-bin.000001 ', master_log_pos = 123456; slave start; you can use show slave status; to see the slave database. However, there is too much information. For ease of viewing, you can use the following command to show slave status/G; view the above Slave_IO_Running: Yes and Slave_ SQL _Running: Yes are both yes, it indicates that the master-slave synchronization is normal, if any one shows NO, it indicates that the synchronization is faulty. You can view the database log files. errors are displayed in the logs. you can troubleshoot the errors step by step. Test in the master mysql server use test create table tt (ii int); then in the slave mysql server use test show tables; mysql> show tables; + ---------------- + | Tables_in_test | + ------------------ + | tt | + ---------------- + 1 row in set (0.00 sec) author wayne173bitsCN.com

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.