master to slave replication in mysql

Posted by vijay on Stack Overflow See other posts from Stack Overflow or by vijay
Published on 2012-08-30T09:36:37Z Indexed on 2012/08/30 9:38 UTC
Read the original article Hit count: 264

Filed under:
|

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 .

© Stack Overflow or respective owner

Related posts about mysql

Related posts about plsql