2003-01-06 01:48:59 +02:00
|
|
|
# This one assumes we are ignoring updates on tables in database mysqltest2,
|
|
|
|
# but doing the ones in database mysqltest
|
2002-07-23 18:31:22 +03:00
|
|
|
|
2000-12-07 07:54:59 -07:00
|
|
|
source include/master-slave.inc;
|
2003-01-06 01:48:59 +02:00
|
|
|
--disable_warnings
|
|
|
|
drop database if exists mysqltest2;
|
|
|
|
create database mysqltest2;
|
|
|
|
drop database if exists mysqltest;
|
|
|
|
create database mysqltest;
|
|
|
|
--enable_warnings
|
|
|
|
|
2001-01-17 05:47:33 -07:00
|
|
|
save_master_pos;
|
2000-11-20 23:38:08 -07:00
|
|
|
connection slave;
|
2001-01-17 05:47:33 -07:00
|
|
|
sync_with_master;
|
2003-02-04 21:52:14 +02:00
|
|
|
create database mysqltest;
|
2003-01-06 01:48:59 +02:00
|
|
|
create table mysqltest2.foo (n int);
|
|
|
|
insert into mysqltest2.foo values(4);
|
2000-11-20 23:38:08 -07:00
|
|
|
connection master;
|
2003-01-06 01:48:59 +02:00
|
|
|
create table mysqltest2.foo (n int);
|
|
|
|
insert into mysqltest2.foo values(5);
|
|
|
|
create table mysqltest.bar (m int);
|
|
|
|
insert into mysqltest.bar values(15);
|
2001-01-17 05:47:33 -07:00
|
|
|
save_master_pos;
|
2000-11-20 23:38:08 -07:00
|
|
|
connection slave;
|
2001-01-17 05:47:33 -07:00
|
|
|
sync_with_master;
|
2003-01-06 01:48:59 +02:00
|
|
|
select mysqltest2.foo.n,mysqltest.bar.m from mysqltest2.foo,mysqltest.bar;
|
2001-01-03 02:15:48 +02:00
|
|
|
connection master;
|
2003-01-06 01:48:59 +02:00
|
|
|
drop database mysqltest;
|
2003-02-04 21:52:14 +02:00
|
|
|
drop database if exists mysqltest2;
|
2001-01-17 05:47:33 -07:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2003-01-25 15:07:51 +02:00
|
|
|
--error 1008
|
2003-02-04 21:52:14 +02:00
|
|
|
drop database mysqltest2;
|
|
|
|
drop database mysqltest;
|
2001-05-28 19:18:23 -06:00
|
|
|
|
2002-07-23 18:31:22 +03:00
|
|
|
# Now let's test load data from master
|
|
|
|
|
|
|
|
# First create some databases and tables on the master
|
2001-05-28 19:18:23 -06:00
|
|
|
|
|
|
|
connection master;
|
|
|
|
set sql_log_bin = 0;
|
2003-01-06 01:48:59 +02:00
|
|
|
create database mysqltest2;
|
|
|
|
create database mysqltest;
|
2001-05-28 19:18:23 -06:00
|
|
|
show databases;
|
2003-01-06 01:48:59 +02:00
|
|
|
create table mysqltest2.t1(n int, s char(20));
|
|
|
|
create table mysqltest2.t2(n int, s text);
|
|
|
|
insert into mysqltest2.t1 values (1, 'one'), (2, 'two'), (3, 'three');
|
|
|
|
insert into mysqltest2.t2 values (11, 'eleven'), (12, 'twelve'), (13, 'thirteen');
|
2001-05-28 19:18:23 -06:00
|
|
|
|
2003-01-06 01:48:59 +02:00
|
|
|
create table mysqltest.t1(n int, s char(20));
|
|
|
|
create table mysqltest.t2(n int, s text);
|
|
|
|
insert into mysqltest.t1 values (1, 'one test'), (2, 'two test'), (3, 'three test');
|
|
|
|
insert into mysqltest.t2 values (11, 'eleven test'), (12, 'twelve test'),
|
|
|
|
(13, 'thirteen test');
|
2001-05-28 19:18:23 -06:00
|
|
|
set sql_log_bin = 1;
|
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
|
|
|
|
2002-07-23 18:31:22 +03:00
|
|
|
# This should show that the slave is empty at this point
|
2001-05-28 19:18:23 -06:00
|
|
|
show databases;
|
|
|
|
load data from master;
|
|
|
|
|
2002-07-23 18:31:22 +03:00
|
|
|
# Now let's check if we have the right tables and the right data in them
|
2001-05-28 19:18:23 -06:00
|
|
|
show databases;
|
2003-01-06 01:48:59 +02:00
|
|
|
use mysqltest2;
|
2001-05-28 19:18:23 -06:00
|
|
|
show tables;
|
2003-01-06 01:48:59 +02:00
|
|
|
use mysqltest;
|
2001-05-28 19:18:23 -06:00
|
|
|
show tables;
|
2003-01-06 01:48:59 +02:00
|
|
|
select * from mysqltest.t1;
|
|
|
|
select * from mysqltest.t2;
|
2001-05-28 19:18:23 -06:00
|
|
|
|
2002-07-23 18:31:22 +03:00
|
|
|
# Now let's see if replication works
|
2001-05-28 19:18:23 -06:00
|
|
|
connection master;
|
2003-01-06 01:48:59 +02:00
|
|
|
insert into mysqltest.t1 values (4, 'four test');
|
2001-05-28 19:18:23 -06:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|
2003-01-06 01:48:59 +02:00
|
|
|
select * from mysqltest.t1;
|
2001-05-28 19:18:23 -06:00
|
|
|
|
2002-07-23 18:31:22 +03:00
|
|
|
# Now time for cleanup
|
2001-05-28 19:18:23 -06:00
|
|
|
connection master;
|
2003-01-06 01:48:59 +02:00
|
|
|
drop database mysqltest;
|
|
|
|
drop database mysqltest2;
|
2001-05-28 19:18:23 -06:00
|
|
|
save_master_pos;
|
|
|
|
connection slave;
|
|
|
|
sync_with_master;
|