To configure the master we need to start binary logging, and some minor tweaking. Before we move ahead, I assume that you have the root or Administrator access to the sytem where you are setting up replication. First let us setup the Binary logging.
To enable binary logging, we need to configure the configuration file /etc/my.cnf on Linux. If you are in Windows, I guess it should be in c:\program files\MySQL\MySQL Server 5.0\my.ini. Open the file and add the following below the [mysqld] section
So the configuration should look something like
[mysqld] log-bin=mysql-bin server-id=1 ... other parameters ... [mysql] ... parameters for mysql client ...
- The directive log-bin defines the file name of the binary log. All the binary logs that will be created in the data directory, are named something like mysql-bin.000004
- The directive server-id is to give the servers in the replication a unique numeric ID. It has to be an integer. So we’ll call our Master Server as 1.
This would set the master, all we require is to restart the Server. You can restart the server (in linux) with either of the following commands
- service mysql restart
- /etc/rc.d/init.d/mysql restart
- mysqladmin -u root -p shutdown
and then mysqld_safe &
In windows, you’d be having an easier interface