log_state.result 6.66 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
set global general_log= OFF;
truncate table mysql.general_log;
truncate table mysql.slow_log;
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name	Value
general_log	OFF
log	OFF
log_slow_queries	OFF
slow_query_log	OFF
flush logs;
set global general_log= ON;
create table t1(f1 int);
select * from mysql.general_log;
event_time	user_host	thread_id	server_id	command_type	argument
17 18
TIMESTAMP	USER_HOST	#	1	Query	create table t1(f1 int)
TIMESTAMP	USER_HOST	#	1	Query	select * from mysql.general_log
19 20 21 22
set global general_log= OFF;
drop table t1;
select * from mysql.general_log;
event_time	user_host	thread_id	server_id	command_type	argument
23 24 25
TIMESTAMP	USER_HOST	#	1	Query	create table t1(f1 int)
TIMESTAMP	USER_HOST	#	1	Query	select * from mysql.general_log
TIMESTAMP	USER_HOST	#	1	Query	set global general_log= OFF
26 27 28 29 30 31 32 33 34 35 36 37 38 39
set global general_log= ON;
flush logs;
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name	Value
general_log	ON
log	ON
log_slow_queries	OFF
slow_query_log	OFF
set session long_query_time=1;
select sleep(2);
sleep(2)
0
40
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
41 42 43 44 45 46
start_time	user_host	query_time	lock_time	rows_sent	rows_examined	db	last_insert_id	insert_id	server_id	sql_text
set global slow_query_log= ON;
set session long_query_time=1;
select sleep(2);
sleep(2)
0
47
select * from mysql.slow_log where sql_text NOT LIKE '%slow_log%';
48
start_time	user_host	query_time	lock_time	rows_sent	rows_examined	db	last_insert_id	insert_id	server_id	sql_text
49
TIMESTAMP	USER_HOST	QUERY_TIME	00:00:00	1	0	test	0	0	1	select sleep(2)
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name	Value
general_log	ON
log	ON
log_slow_queries	ON
slow_query_log	ON
set global general_log= ON;
set global general_log= OFF;
set global general_log= OFF;
set global slow_query_log= ON;
set global slow_query_log= OFF;
set global slow_query_log= OFF;
set global general_log= ON;
truncate table mysql.general_log;
create table t1(f1 int);
drop table t1;
select * from mysql.general_log;
event_time	user_host	thread_id	server_id	command_type	argument
70 71 72
TIMESTAMP	USER_HOST	#	1	Query	create table t1(f1 int)
TIMESTAMP	USER_HOST	#	1	Query	drop table t1
TIMESTAMP	USER_HOST	#	1	Query	select * from mysql.general_log
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
set global general_log= OFF;
truncate table mysql.general_log;
select * from mysql.general_log;
event_time	user_host	thread_id	server_id	command_type	argument
set global general_log= ON;
show global variables
where Variable_name = 'log' or Variable_name = 'log_slow_queries' or
Variable_name = 'general_log' or Variable_name = 'slow_query_log';
Variable_name	Value
general_log	ON
log	ON
log_slow_queries	OFF
slow_query_log	OFF
show variables like 'general_log_file';
Variable_name	Value
general_log_file	#
show variables like 'slow_query_log_file';
Variable_name	Value
slow_query_log_file	#
show variables like 'log_output';
Variable_name	Value
log_output	FILE,TABLE
set global general_log_file='/not exiting path/log.master';
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
97 98
set global general_log_file='MYSQLTEST_VARDIR';
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'MYSQLTEST_VARDIR'
99 100 101 102 103 104
set global general_log_file='';
ERROR 42000: Variable 'general_log_file' can't be set to the value of ''
show variables like 'general_log_file';
Variable_name	Value
general_log_file	#
set global general_log= OFF;
105
set global general_log_file='MYSQLTEST_VARDIR/tmp/log.master';
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
set global general_log= ON;
create table t1(f1 int);
drop table t1;
set global general_log= OFF;
set global general_log_file=default;
set global general_log= ON;
create table t1(f1 int);
drop table t1;
show variables like 'general_log_file';
Variable_name	Value
general_log_file	#
show variables like 'slow_query_log_file';
Variable_name	Value
slow_query_log_file	#
set global general_log= default;
set global slow_query_log= default;
set global general_log_file= default;
set global slow_query_log_file= default;
show variables like 'general_log';
Variable_name	Value
general_log	OFF
show variables like 'slow_query_log';
Variable_name	Value
slow_query_log	OFF
set global general_log=ON;
set global log_output=default;
show variables like 'log_output';
Variable_name	Value
134
log_output	FILE
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
set global general_log=OFF;
set global log_output=FILE;
truncate table mysql.general_log;
show variables like 'log_output';
Variable_name	Value
log_output	FILE
set global general_log=ON;
create table t1(f1 int);
select * from mysql.general_log;
event_time	user_host	thread_id	server_id	command_type	argument
set global general_log=OFF;
set global log_output="FILE,TABLE";
show variables like 'log_output';
Variable_name	Value
log_output	FILE,TABLE
set global general_log=ON;
drop table t1;
select * from mysql.general_log;
event_time	user_host	thread_id	server_id	command_type	argument
154 155
TIMESTAMP	USER_HOST	#	1	Query	drop table t1
TIMESTAMP	USER_HOST	#	1	Query	select * from mysql.general_log
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
SET @old_general_log_state = @@global.general_log;
SET @old_slow_log_state = @@global.slow_query_log;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
FLUSH TABLES WITH READ LOCK;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
UNLOCK TABLES;
FLUSH TABLES WITH READ LOCK;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
UNLOCK TABLES;
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = OFF;
SET GLOBAL slow_query_log = OFF;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL READ_ONLY = ON;
SET GLOBAL general_log = ON;
SET GLOBAL slow_query_log = ON;
SET GLOBAL READ_ONLY = OFF;
SET GLOBAL general_log = @old_general_log_state;
SET GLOBAL slow_query_log = @old_slow_log_state;
178 179 180 181 182 183 184 185 186 187 188 189 190
set @old_general_log_file= @@global.general_log_file;
set @old_slow_query_log_file= @@global.slow_query_log_file;
set global general_log_file= concat('/not exiting path/log.maste', 'r');
ERROR 42000: Variable 'general_log_file' can't be set to the value of '/not exiting path/log.master'
set global general_log_file= NULL;
ERROR 42000: Variable 'general_log_file' can't be set to the value of 'NULL'
set global slow_query_log_file= concat('/not exiting path/log.maste', 'r');
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of '/not exiting path/log.master'
set global slow_query_log_file= NULL;
ERROR 42000: Variable 'slow_query_log_file' can't be set to the value of 'NULL'
set global general_log_file= @old_general_log_file;
set global slow_query_log_file= @old_slow_query_log_file;
End of 5.1 tests