master to slave replication in mysql
- by vijay
i need master to slave replication in mysql
so i am creating this procedure to change the master dynamically by procedure
delimiter //
CREATE PROCEDURE change_master( in host_ip varchar(50))
begin
stop slave;
CHANGE MASTER TO MASTER_HOST = host_ip, MASTER_PORT=3306, MASTER_USER='replication', MASTER_PASSWORD='slave';
start slave;
end;
//
but i am getting a error.
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'host_ip, MASTER_PORT=3306, MASTER_USER='replication', MASTER_PASSWORD='slave';
s' at line 4
if i left it blank then fine
eg.
CHANGE MASTER TO MASTER_HOST = '', MASTER_PORT=3306, MASTER_USER='replication', MASTER_PASSWORD='slave';
i tried many time but in this query i am not able to use any variable
why?
if u know help me.
thanks .