MYSQL Master/Slave configuration on the same server

Source: Internet
Author: User

The same server MYSQL master-slave configuration installs two MYSQL services on one server, and configures master-slave management of the MYSQL service. (1) modify the my. ini file (master ). Add log-bin = E: /MySqlData/mysql-bin // location of the log file server-id = 1 // ID id binlog-do-db = databaseName // binlog-ignore-db = mysql // binlog-ignore-db = test binlog-ignore-db = information_schema replicate-wild-ignore-table = databaseName. table % // ignore the synchronized table, rule query document expire_logs_days = 1 // The binary log innodb_flush_log_at_trx_commit = 1 is automatically cleared in one day. // logs must be written to (flush) for each transaction commit or non-transaction instruction) hard Disk sync-binlog = 1 // enable binlog to synchronize po with hard disk after every N binlog writes Rt = 3306 // The master database port basedir = "D:/java/javasoft/MYSQL/" // database installation path datadir = "E: /MySqlData/Data/"// modify the my1.ini file (slave) in the database Data directory. Create a new file. Is the configuration file from the MYSQL service. Server-id = 2 master-host = 127.0.0.1 // host name master-user = name // master database username (for details about adding database users, refer to the following content) master-pass = password // master database password master-port = 3306 master-connect-retry = 60 replicate-do-db = replicate-ignore-db = mysql ignores the database expire_logs_days = 1 // Number of days when binary logs are automatically deleted port = 3307 // The port is different from the master's basedir = "D: /java/export oft/MYSQL/"datadir =" E:/MySqlData/data1/"// The data directory is different. Add the Database User: grant replication slave on *. * TO 'username '@ 'Localhost' identified by 'Password' Add the DOS command statement for MYSQL service to windows service. D: \ java \ mongooft \ MYSQL \ bin \ mysqld -- install serverName -- defaults-file = d: \ java \ mongooft \ MYSQL \ my. run the "SC delete serverName" command to delete a service from ini: start the service of the primary database, start the service of the slave database, and test the service.

Related Article

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.