1. Install the configuration
Install MySQL on both servers in the/usr/local/MySQL directory (the installation steps are omitted. Refer to the relevant documentation ), the IP addresses of the two servers are 192.168.0.1 and 192.168.0.2. We use 192.168.0.1 as the master database and 192.168.0.2 as the slave server. We adopt one-way synchronization, that is, the master data is the master data, then, slave takes the initiative to sync data back from the master.
The configuration of the two servers is the same, we copy the key configuration file, the default configuration file is in the/usr/local/MySQL/share/MySQL directory, there are my-large.cnf, respectively, my-medium.cnf, my-small.cnf and so on several writers, we just test, use my-medium.cnf on the line. After MySQL is installed, the default configuration file is specified in the database storage directory. We use 4.1.x, therefore, the configuration file should be in the/usr/local/MySQL/var directory, so you can copy the configuration file:
CP/usr/local/MySQL/share/MySQL/my-medium.cnf/usr/local/MySQL/var/My. CNF two servers perform the same copy configuration file operation.
2. Configure the master server
We need to configure 192.168.0.1 as the primary MySQL Server (master), so we need to consider that we need to synchronize that database and use that user for synchronization. Here we will use the root user for synchronization for the sake of simplicity, in addition, you only need to synchronize the database ABC.
Open the configuration file:
VI/usr/local/MySQL/var/My. CNF find the following information:
# Required unique ID between 1 and 2 ^ 32-1 phpchina Open SourceCommunityPortal