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 |
drop database if exists mysqltest1; |
|
8 |
create database mysqltest1; |
|
9 |
use mysqltest1; |
|
10 |
create table t1 (a int); |
|
11 |
insert into t1 values(9); |
|
12 |
select * from mysqltest1.t1; |
|
13 |
a
|
|
14 |
9
|
|
15 |
show databases like 'mysqltest1'; |
|
16 |
Database (mysqltest1) |
|
17 |
mysqltest1
|
|
18 |
select * from test.t1; |
|
19 |
a
|
|
20 |
9
|
|
21 |
drop table t1; |
|
22 |
drop database mysqltest1; |
|
23 |
drop database if exists rewrite; |
|
24 |
create database rewrite; |
|
25 |
use test; |
|
26 |
create table t1 (a date, b date, c date not null, d date); |
|
27 |
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ','; |
|
28 |
Warnings: |
|
29 |
Warning 1265 Data truncated for column 'a' at row 1 |
|
30 |
Warning 1265 Data truncated for column 'c' at row 1 |
|
31 |
Warning 1265 Data truncated for column 'd' at row 1 |
|
32 |
Warning 1265 Data truncated for column 'a' at row 2 |
|
33 |
Warning 1265 Data truncated for column 'b' at row 2 |
|
34 |
Warning 1265 Data truncated for column 'd' at row 2 |
|
35 |
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' IGNORE 2 LINES; |
|
36 |
select * from rewrite.t1; |
|
37 |
a b c d |
|
38 |
0000-00-00 NULL 0000-00-00 0000-00-00 |
|
39 |
0000-00-00 0000-00-00 0000-00-00 0000-00-00 |
|
40 |
2003-03-03 2003-03-03 2003-03-03 NULL |
|
41 |
2003-03-03 2003-03-03 2003-03-03 NULL |
|
42 |
truncate table t1; |
|
43 |
load data infile '../std_data_ln/loaddata1.dat' into table t1 fields terminated by ',' LINES STARTING BY ',' (b,c,d); |
|
44 |
Warnings: |
|
45 |
Warning 1265 Data truncated for column 'c' at row 1 |
|
46 |
Warning 1265 Data truncated for column 'd' at row 1 |
|
47 |
Warning 1265 Data truncated for column 'b' at row 2 |
|
48 |
Warning 1265 Data truncated for column 'd' at row 2 |
|
49 |
select * from rewrite.t1; |
|
50 |
a b c d |
|
51 |
NULL NULL 0000-00-00 0000-00-00 |
|
52 |
NULL 0000-00-00 0000-00-00 0000-00-00 |
|
53 |
NULL 2003-03-03 2003-03-03 NULL |
|
54 |
drop table t1; |
|
55 |
create table t1 (a text, b text); |
|
56 |
load data infile '../std_data_ln/loaddata2.dat' into table t1 fields terminated by ',' enclosed by ''''; |
|
57 |
Warnings:
|
|
58 |
Warning 1261 Row 3 doesn't contain data for all columns
|
|
59 |
select concat('|',a,'|'), concat('|',b,'|') from rewrite.t1;
|
|
60 |
concat('|',a,'|') concat('|',b,'|')
|
|
61 |
|Field A| |Field B|
|
|
62 |
|Field 1| |Field 2'
|
|
63 |
Field 3,'Field 4|
|
|
64 |
|Field 5' ,'Field 6| NULL
|
|
65 |
|Field 6| | 'Field 7'|
|
|
66 |
drop table t1;
|
|
67 |
create table t1 (a int, b char(10));
|
|
68 |
load data infile '../std_data_ln/loaddata3.dat' into table t1 fields terminated by '' enclosed by '' ignore 1 lines;
|
|
69 |
Warnings:
|
|
70 |
Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3
|
|
71 |
Warning 1262 Row 3 was truncated; it contained more data than there were input columns
|
|
72 |
Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5
|
|
73 |
Warning 1262 Row 5 was truncated; it contained more data than there were input columns
|
|
74 |
select * from rewrite.t1;
|
|
75 |
a b
|
|
76 |
1 row 1
|
|
77 |
2 row 2
|
|
78 |
0 1234567890
|
|
79 |
3 row 3
|
|
80 |
0 1234567890
|
|
81 |
truncate table t1;
|
|
82 |
load data infile '../std_data_ln/loaddata4.dat' into table t1 fields terminated by '' enclosed by '' lines terminated by '' ignore 1 lines;
|
|
83 |
Warnings:
|
|
84 |
Warning 1366 Incorrect integer value: '
|
|
85 |
' for column 'a' at row 4
|
|
86 |
Warning 1261 Row 4 doesn't contain data for all columns
|
|
87 |
select * from rewrite.t1;
|
|
88 |
a b
|
|
89 |
1 row 1
|
|
90 |
2 row 2
|
|
91 |
3 row 3
|
|
92 |
0
|
|
93 |
drop database rewrite;
|
|
94 |
drop table t1;
|