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.