To set up a master/slave database, perform the following steps from the command line.

  1. The first step is to determine which address the MySQL server is bound to. To do this, locate the line of the MySQL configuration file that contains the bind-address parameter:
    bind-address            = 127.0.0.1
    

    This IP address will be set to whichever IP address the master server uses.

  2. Next, uncomment the line of the MySQL configuration file that contains the server-id, which is most probably located at /etc/my.cn or /etc/mysql/mysql.conf.d/mysqld.cnf.
  3. The Unix sed command can perform this easily:
    $ sed -i s/#server-id/server-id/g  /etc/mysql/my.cnf
    

    Tip

    The /etc/mysql/my.cnf string will need to be substituted with the correct filename

Advertisements