1
by brian
clean slate |
1 |
stop slave;
|
2 |
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
3 |
reset master;
|
|
4 |
reset slave;
|
|
5 |
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
6 |
start slave;
|
|
7 |
create user test;
|
|
8 |
create table t1(a int) engine=InnoDB;
|
|
9 |
create table t2(a int) engine=MyISAM;
|
|
10 |
insert into t1 values(1001);
|
|
11 |
insert into t2 values(2001);
|
|
12 |
set global read_only=1;
|
|
13 |
select @@read_only;
|
|
14 |
@@read_only
|
|
15 |
1
|
|
16 |
select * from t1;
|
|
17 |
a
|
|
18 |
1001
|
|
19 |
select * from t2;
|
|
20 |
a
|
|
21 |
2001
|
|
22 |
select @@read_only;
|
|
23 |
@@read_only
|
|
24 |
0
|
|
25 |
select * from t1;
|
|
26 |
a
|
|
27 |
1001
|
|
28 |
select * from t2;
|
|
29 |
a
|
|
30 |
2001
|
|
31 |
set global read_only=0;
|
|
32 |
BEGIN;
|
|
33 |
insert into t1 values(1002);
|
|
34 |
insert into t2 values(2002);
|
|
35 |
BEGIN;
|
|
36 |
insert into t1 values(1003);
|
|
37 |
insert into t2 values(2003);
|
|
38 |
set global read_only=1;
|
|
39 |
COMMIT;
|
|
40 |
COMMIT;
|
|
41 |
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
|
42 |
set global read_only=0;
|
|
43 |
insert into t1 values(1004);
|
|
44 |
insert into t2 values(2004);
|
|
45 |
select * from t1;
|
|
46 |
a
|
|
47 |
1001
|
|
48 |
1002
|
|
49 |
1004
|
|
50 |
select * from t2;
|
|
51 |
a
|
|
52 |
2001
|
|
53 |
2002
|
|
54 |
2003
|
|
55 |
2004
|
|
56 |
select * from t1;
|
|
57 |
a
|
|
58 |
1001
|
|
59 |
1002
|
|
60 |
1004
|
|
61 |
select * from t2;
|
|
62 |
a
|
|
63 |
2001
|
|
64 |
2002
|
|
65 |
2003
|
|
66 |
2004
|
|
67 |
set global read_only=1;
|
|
68 |
select @@read_only;
|
|
69 |
@@read_only
|
|
70 |
1
|
|
71 |
show create table t1;
|
|
72 |
Table Create Table
|
|
73 |
t1 CREATE TABLE `t1` (
|
|
74 |
`a` int(11) DEFAULT NULL
|
|
75 |
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
|
76 |
show create table t2;
|
|
77 |
Table Create Table
|
|
78 |
t2 CREATE TABLE `t2` (
|
|
79 |
`a` int(11) DEFAULT NULL
|
|
80 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
81 |
insert into t1 values(1005);
|
|
82 |
insert into t2 values(2005);
|
|
83 |
select * from t1;
|
|
84 |
a
|
|
85 |
1001
|
|
86 |
1002
|
|
87 |
1004
|
|
88 |
1005
|
|
89 |
select * from t2;
|
|
90 |
a
|
|
91 |
2001
|
|
92 |
2002
|
|
93 |
2003
|
|
94 |
2004
|
|
95 |
2005
|
|
96 |
select * from t1;
|
|
97 |
a
|
|
98 |
1001
|
|
99 |
1002
|
|
100 |
1004
|
|
101 |
1005
|
|
102 |
select * from t2;
|
|
103 |
a
|
|
104 |
2001
|
|
105 |
2002
|
|
106 |
2003
|
|
107 |
2004
|
|
108 |
2005
|
|
109 |
insert into t1 values(1006);
|
|
110 |
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
|
111 |
insert into t2 values(2006);
|
|
112 |
ERROR HY000: The MySQL server is running with the --read-only option so it cannot execute this statement
|
|
113 |
drop user test;
|
|
114 |
drop table t1;
|
|
115 |
drop table t2;
|
|
116 |
set global read_only=0;
|