我们要把192.168.0.1配置为主mysql服务器(master),那么我们就要考虑我们需要同步那个数据库,使用那个用户同步,我们这里为了简单起见,就使用root用户进行同步,并且只需要同步数据库abc。
打开配置文件:
vi /usr/local/mysql/var/my.cnf
找到一下信息:
# 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 //1为master,2为salve
我们的slave服务器主要是主动去master服务器同步数据回来,我们编辑配置文件:
vi /usr/local/mysql/var/my.cnf
找到下面类似的信息:
# 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