In the past, we needed two mysql databases to implement the master-slave configuration for Data Synchronization updates. Now I will introduce phpmyadmin in a higher version to quickly implement this function. Below I will introduce it to you in text.
In the past, we needed two mysql databases to implement the master-slave configuration for Data Synchronization updates. Now I will introduce phpmyadmin in a higher version to quickly implement this function. Below I will introduce it to you in text.
As a slave server. Here I share process 1
If something is wrong, point it out to the netizens.
System: centos linux Server IP Address: 192.168.0.8 windows2003 Server
IP address of a server: 192.168.0.9
Software: centos linux server to install a mysql-server5.0 windows2003
Install a software named Apmserv with a mysql5.1 and phpmyadmin (image
Manage MYSQL databases)
I. First, create a user in the primary service to synchronize data. Here I use
Create a MYSQL database using a graphic management software (phpmyadmin)
Note that you must have the replicaiion permission.
SlaveBoth replication permissions:
2. Can I use the user admin I just created in windows2003 on the slave server?
The usage of connecting to the linux (master server) Apmserv is not described here.
Run mysql-h 192.168.0.8-u admin-p on the slave server and enter the password.
(Note: because mysql does not exist in ipvs, an environment variable must be added)
3. Configure the master server configuration file vim/etc/my. cnf
Server-id = 1
Log-bin
These two rows are newly added.
Restart mysql
Mysql-u root-p
Show master status;
(This indicates that the master server is successfully configured)
4. The slave server configuration file is also my. cnf
Server-id = 2 slave server id
Master-host master server address
Master-port number
Username required for master-user Replication
Password for the username required for master-password Replication
Replicate-do-db
Then restart the database.
Mysql> show slave statusG;
The Master/Slave server creates a new database named test1, which can be synchronized from the master server to. * When the IP address of the master server changes, data is inserted to the slave server. It is useless to modify/etc/my. cnf only for synchronization. The following command is required:
Stop slave;
Reset slave;
Change master
MASTER_HOST = 'master _ ip ',
-> MASTER_USER = 'replication _ user_name ',
-> MASTER_PASSWORD = 'replication _ password ',
-> MASTER_LOG_FILE = 'recorded _ log_file_name ',
-> MASTER_LOG_POS = recorded_log_position;
Start slave; |
Replace master_ip, master_user, and master_password with the master IP address, the user with the copy permission, and the password.
Replace recorded_log_file_name with the file recorded above, and recorded_log_position with the position recorded above.