2
# Server are started in "var/master-data", so "../tmp" will be "var/tmp"
3
eval set @tmpdir="../tmp";
7
# test of into outfile|dumpfile
11
drop table if exists t1;
14
create table t1 (`a` blob);
15
insert into t1 values("hello world"),("Hello mars"),(NULL);
17
eval select * into outfile "../tmp/outfile-test.1" from t1;
19
select load_file(concat(@tmpdir,"/outfile-test.1"));
21
eval select * into dumpfile "../tmp/outfile-test.2" from t1 limit 1;
23
select load_file(concat(@tmpdir,"/outfile-test.2"));
25
eval select * into dumpfile "../tmp/outfile-test.3" from t1 where a is null;
27
select load_file(concat(@tmpdir,"/outfile-test.3"));
29
# the following should give errors
33
eval select * into outfile "../tmp/outfile-test.1" from t1;
36
eval select * into dumpfile "../tmp/outfile-test.2" from t1;
39
eval select * into dumpfile "../tmp/outfile-test.3" from t1;
41
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
42
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1
43
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.2
44
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.3
49
eval select 1 into outfile "../tmp/outfile-test.4";
51
select load_file(concat(@tmpdir,"/outfile-test.4"));
52
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
55
# Bug #5382: 'explain select into outfile' crashes the server
58
CREATE TABLE t1 (a INT);
61
INTO OUTFILE '/tmp/t1.txt'
62
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\r\n'
69
# Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails
72
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
73
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
74
FROM information_schema.schemata LIMIT 0, 5;
76
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
78
use information_schema;
80
eval SELECT * INTO OUTFILE "../tmp/outfile-test.4"
81
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
82
FROM schemata LIMIT 0, 5;
84
--remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4
88
# Bug#18628 mysql-test-run: security problem
90
# It should not be possible to write to a file outside of vardir
91
create table t1(a int);
92
--replace_result $DRIZZLE_TEST_DIR DRIZZLE_TEST_DIR
94
eval select * into outfile "$DRIZZLE_TEST_DIR/outfile-test1" from t1;
98
# Bug#28181 Access denied to 'information_schema when
99
# select into out file (regression)
101
create database mysqltest;
102
create user user_1@localhost;
103
grant all on mysqltest.* to user_1@localhost;
104
connect (con28181_1,localhost,user_1,,mysqltest);
106
--error ER_ACCESS_DENIED_ERROR
107
eval select schema_name
108
into outfile "../tmp/outfile-test.4"
109
fields terminated by ',' optionally enclosed by '"'
110
lines terminated by '\n'
111
from information_schema.schemata
112
where schema_name like 'mysqltest';
115
grant file on *.* to user_1@localhost;
117
connect (con28181_2,localhost,user_1,,mysqltest);
118
eval select schema_name
119
into outfile "../tmp/outfile-test.4"
120
fields terminated by ',' optionally enclosed by '"'
121
lines terminated by '\n'
122
from information_schema.schemata
123
where schema_name like 'mysqltest';
126
--exec rm $MYSQLTEST_VARDIR/tmp/outfile-test.4
128
revoke all privileges on *.* from user_1@localhost;
129
drop user user_1@localhost;
130
drop database mysqltest;