If you require, you set up replication from one MySQL instance to another, ensuring that you have a second copy of the database on another machine which is automatically kept in sync with the first.
This will involve editing your my.cnf or my.ini config file. Under Mac OS X you may need to create the /etc/my.cnf file first, see 3.2 above. Under Windows the file is called my.ini and is normally located in C:Program FilesMySQLMySQL Server 5.0. In both cases you should review the existing file and merge in the changes below.
- On the master machine, edit your my.cnf or my.ini config file and add the following
[mysqld] log-bin=mysql-bin server-id=1
- On the master, execute the following mysql command:
GRANT REPLICATION SLAVE ON *.* TO 'repl'@'%.mydomain.com' IDENTIFIED BY 'slavepass' ;
(You can change the replication user ‘repl’ and password ‘slavepass’ as required. Replace mydomain.com with your domain name.)
- On the master, execute the following mysql command and note the file and position:
FLUSH TABLES WITH READ LOCK; SHOW MASTER STATUS;
- On the slave machine, edit my.cnf/my.ini and add the following:
[mysqld] log-bin=mysql-bin server-id=2
(You can choose different server-id’s if necessary, the important thing is that the master and slave are different from each other.)
- On the slave, execute the following mysql command:
CHANGE MASTER TO MASTER_HOST='hostname', MASTER_USER='repl', MASTER_PASSWORD='slavepass', MASTER_LOG_FILE='filename', MASTER_LOG_POS=filepos;
Replace hostname with the host of the master. Replace ‘slavepass’ (and ‘repl’ if necessary) with the user name and password you set up at step 2. Replace filename and filepos with the values you noted at step 3 (use ‘’ and 4 if not otherwise specified).
- You can start and stop the slave and check its status using the following mysql commands:
STOP SLAVE; START SLAVE; SHOW SLAVE STATUS;
Refer to the MySQL documentation for further details if required.
As set up by default the catdv database user is configured to use a relatively easy to guess password, on the assumption that unauthorised people will not have direct access to the server machine. If you require additional security you should set up a database password for the catdv database user as follows. (Note that the the catdv database password is not the same as the MySQL root password, which applies to all databases, not just the catdv one.)
Prior to setting up the database you can edit the create script and add “IDENTIFIED BY xxxx;” to the end of the “GRANT” lines, where “ xxxx ” is your chosen password (for the catdv user, not the MySQL root user). You can also set a password after creating the database by typing “mysqladmin -u catdv password xxxx “.
If you set a database password then you will need to edit the catdv.properties configuration file (the easiest way to do this is by launching the CatDV Control Panel). Edit this line to include your chosen password.
You can also edit this line to specify a database server running on a different machine from the the CatDV server (ie. not localhost). If you do this you will need to grant database access to a user other than “catdv@localhost” or you will get an access denied error when you try to start the CatDV Server. Refer to the MySQL user manual for more details.