| 1 |
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; |
| 2 |
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; |
| 3 |
connection master; |
| 4 |
CREATE DATABASE federated; |
| 5 |
connection slave; |
| 6 |
CREATE DATABASE federated; |
| 7 |
connection master; |
| 8 |
SET @OLD_MASTER_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT; |
| 9 |
SET @@GLOBAL.CONCURRENT_INSERT= 0; |
| 10 |
create user [email protected] identified by 'def'; |
| 11 |
grant all privileges on federated.* to [email protected]; |
| 12 |
connection slave; |
| 13 |
SET @OLD_SLAVE_CONCURRENT_INSERT= @@GLOBAL.CONCURRENT_INSERT; |
| 14 |
SET @@GLOBAL.CONCURRENT_INSERT= 0; |
| 15 |
create user [email protected] identified by 'def'; |
| 16 |
grant all privileges on federated.* to [email protected]; |
| 17 |
CREATE TABLE federated.t1 ( |
| 18 |
`id` int auto_increment primary key, |
| 19 |
`value` int |
| 20 |
) ENGINE=MyISAM; |
| 21 |
INSERT INTO federated.t1 SET value=1; |
| 22 |
INSERT INTO federated.t1 SET value=2; |
| 23 |
INSERT INTO federated.t1 SET value=2; |
| 24 |
connection master; |
| 25 |
CREATE TABLE federated.t1 ( |
| 26 |
`id` int auto_increment primary key, |
| 27 |
`value` int |
| 28 |
) ENGINE=FEDERATED |
| 29 |
CONNECTION='mysql://[email protected]:SLAVE_PORT/federated/t1'; |
| 30 |
SELECT * from federated.t1; |
| 31 |
id value |
| 32 |
1 1 |
| 33 |
2 2 |
| 34 |
3 2 |
| 35 |
INSERT INTO federated.t1 SET value=4; |
| 36 |
SELECT LAST_INSERT_ID(); |
| 37 |
LAST_INSERT_ID() |
| 38 |
4 |
| 39 |
|
| 40 |
5 inserted |
| 41 |
6 inserted |
| 42 |
|
| 43 |
7 inserted |
| 44 |
8 inserted |
| 45 |
SELECT * from federated.t1; |
| 46 |
id value |
| 47 |
1 1 |
| 48 |
2 2 |
| 49 |
3 2 |
| 50 |
4 4 |
| 51 |
5 54 |
| 52 |
6 55 |
| 53 |
7 54 |
| 54 |
8 55 |
| 55 |
DROP TABLE federated.t1; |
| 56 |
drop user [email protected]; |
| 57 |
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_MASTER_CONCURRENT_INSERT; |
| 58 |
connection slave; |
| 59 |
DROP TABLE federated.t1; |
| 60 |
drop user [email protected]; |
| 61 |
SET @@GLOBAL.CONCURRENT_INSERT= @OLD_SLAVE_CONCURRENT_INSERT; |
| 62 |
connection master; |
| 63 |
DROP TABLE IF EXISTS federated.t1; |
| 64 |
DROP DATABASE IF EXISTS federated; |
| 65 |
connection slave; |
| 66 |
DROP TABLE IF EXISTS federated.t1; |
| 67 |
DROP DATABASE IF EXISTS federated; |