MySQL Replication

So Yesterday I setup MySQL replication for databases. I used these institutions found here.  But I ran into some issues when trying to run “show master status;” as I determined that binary logging wasn’t turned on. Which is needed in order to track and replicated databases changes. So to enable that I needed to add

log-bin = /var/log/mysql/mysql-bin.log

to /etc/mysql/my.cnf

But this line was already added to the file by following the institutions but didn’t work. My issue was that I added the line to the bottom of the file. It needs to be added higher up with  the following lines.

server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 10
max_binlog_size = 100M

Other than that the instructions work great!

To add multiple databases to replicated.

On the slave in /etc/mysql/my.cnf just add another line replacing the “databases2″ with the name of the second database.

replicate-do-db=databases2

Well thats it hope that helps someone else out!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>