MySQL master-slave replikering (4)

Mysql Master Slave Replication



Vi opretter en test1-database på værten, udfører operationerne med at oprette tabeller og indsætte data separat og ser, om slaven kan synkronisere værtsdataene.



CREATE TABLE `t_users` ( `user_id` varchar(64) NOT NULL COMMENT'Registered user ID', `user_email` varchar(64) NOT NULL COMMENT'Registered user mailbox', `user_password` varchar(64) NOT NULL COMMENT'Registered user password', `user_nikename` varchar(64) NOT NULL COMMENT'Registered user nickname', `user_creatime` datetime NOT NULL COMMENT'Registration time', `user_status` tinyint(1) NOT NULL COMMENT'Verification status 1: verified 0: not verified', `user_deleteflag` tinyint(1) NOT NULL COMMENT'Delete flag 1: deleted 0: not deleted', PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 INSERT INTO t_users(user_id,user_email,user_password,user_nikename,user_creatime,user_status,user_deleteflag) VALUES('1','root@xxxxx','123455','zhangsan',NOW(),1,0) INSERT INTO t_users(user_id,user_email,user_password,user_nikename,user_creatime,user_status,user_deleteflag) VALUES('2','root@xxxxx','123455','lisi',NOW(),1,0) SELECT * FROM t_users

Åbn slaven direkte, vi finder slavernes test1 database, t_users tabel og to poster synkroniseres