mysql -V mysql Ver 14.12 Distrib 5.0.45, for pc-linux-gnu (i686) using readline 5.0
第二步:在主服务器上建立用于复制的帐号。该账户必须授予REPLICATION SLAVE权限。 mysql> GRANT FILE,SELECT,REPLICATION SLAVE ON *.* TO repuser@slavehost IDENTIFIED BY 'password'; 如果想要在Slave上有权限执行 "LOAD TABLE FROM MASTER" 或 "LOAD DATA FROM MASTER" 语句的话,必须授予全局的 FILE 和 SELECT 权限: mysql>GRANT FILE,SELECT,REPLICATION SLAVE ON *.* TO 'repuser@'slave_host' IDENTIFIED BY 'password'; 建立完帐号后,在slave_host上使用mysql -h masterhost -urepuser -ppassword测试帐号建立是否成功;
# Replication Master Server (default) # binary logging is required for replication log-bin=mysql-bin # required unique id between 1 and 2^32 - 1 # defaults to 1 if master-host is not set # but will not function as a master if omitted server-id = 1