I have a mysql master database running. I want to have a slave database. So, I stopped the master mysql database and copied it to the slave machine. I had bin log enabled on master so even those files are copied.
I am not sure, how to start replication on the slave. Any help would be appreciated.
I am still copying data into slave.
mysql> show master status; +-------------------+----------+--------------+------------------+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +-------------------+----------+--------------+------------------+ | mydbm1-bin.008524 | 1330529 | | | +-------------------+----------+--------------+------------------+ 1 row in set (0.00 sec)
By the way, many new rows have been inserted into the master after the snapshot is copied to slave.
Best Answer
Going by your question, I will like to review what I believe you did thus far:
Look at the Slave's last binlog. From the question, it should be
mydbm1-bin.008524
Believe it or not, you have to do a few things:
1) On the Master, create a replication user like this:
2) Make /var/lib/mysql on the Slave owned by
mysql
user3) Make sure Master's server_id is explicitly set in
my.cnf
4) Make sure Slave's server_id is explicitly set in
my.cnf
5) Startup mysql on the Slave
6) Setup replication by running this on the Slave
You will see something like this:
If
Slave_IO_Running
andSlave_SQL_Running
are bothYes
, CONGRATULATIONS !!!I already answered a post back on Feb 06, 2012 ( How to setup replication(Master/slave) in MySQL 5.5.20? ) with essentially the same steps.
I wanted to add additional posts I made for setting up Circular Replication should you decide to setup the two DB servers as Master/Master
Sep 24, 2012
: Setting up MySQL circular replication in existing replication topology?May 07, 2012
: Setting Circular Replication in mysql