You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

697 lines
24 KiB

24 years ago
21 years ago
21 years ago
  1. drop table if exists t1,t2;
  2. set @my_binlog_cache_size =@@global.binlog_cache_size;
  3. set @my_connect_timeout =@@global.connect_timeout;
  4. set @my_delayed_insert_timeout =@@global.delayed_insert_timeout;
  5. set @my_delayed_queue_size =@@global.delayed_queue_size;
  6. set @my_flush =@@global.flush;
  7. set @my_flush_time =@@global.flush_time;
  8. set @my_key_buffer_size =@@global.key_buffer_size;
  9. set @my_max_binlog_cache_size =@@global.max_binlog_cache_size;
  10. set @my_max_binlog_size =@@global.max_binlog_size;
  11. set @my_max_connect_errors =@@global.max_connect_errors;
  12. set @my_max_delayed_threads =@@global.max_delayed_threads;
  13. set @my_max_heap_table_size =@@global.max_heap_table_size;
  14. set @my_max_insert_delayed_threads=@@global.max_insert_delayed_threads;
  15. set @my_max_join_size =@@global.max_join_size;
  16. set @my_max_user_connections =@@global.max_user_connections;
  17. set @my_max_write_lock_count =@@global.max_write_lock_count;
  18. set @my_myisam_data_pointer_size =@@global.myisam_data_pointer_size;
  19. set @my_net_buffer_length =@@global.net_buffer_length;
  20. set @my_net_write_timeout =@@global.net_write_timeout;
  21. set @my_net_read_timeout =@@global.net_read_timeout;
  22. set @my_query_cache_limit =@@global.query_cache_limit;
  23. set @my_query_cache_type =@@global.query_cache_type;
  24. set @my_rpl_recovery_rank =@@global.rpl_recovery_rank;
  25. set @my_server_id =@@global.server_id;
  26. set @my_slow_launch_time =@@global.slow_launch_time;
  27. set @my_storage_engine =@@global.storage_engine;
  28. set @my_thread_cache_size =@@global.thread_cache_size;
  29. set @`test`=1;
  30. select @test, @`test`, @TEST, @`TEST`, @"teSt";
  31. @test @`test` @TEST @`TEST` @"teSt"
  32. 1 1 1 1 1
  33. set @TEST=2;
  34. select @test, @`test`, @TEST, @`TEST`, @"teSt";
  35. @test @`test` @TEST @`TEST` @"teSt"
  36. 2 2 2 2 2
  37. set @"tEST"=3;
  38. select @test, @`test`, @TEST, @`TEST`, @"teSt";
  39. @test @`test` @TEST @`TEST` @"teSt"
  40. 3 3 3 3 3
  41. set @`TeST`=4;
  42. select @test, @`test`, @TEST, @`TEST`, @"teSt";
  43. @test @`test` @TEST @`TEST` @"teSt"
  44. 4 4 4 4 4
  45. select @`teST`:=5;
  46. @`teST`:=5
  47. 5
  48. select @test, @`test`, @TEST, @`TEST`, @"teSt";
  49. @test @`test` @TEST @`TEST` @"teSt"
  50. 5 5 5 5 5
  51. set @select=2,@t5=1.23456;
  52. select @`select`,@not_used;
  53. @`select` @not_used
  54. 2 NULL
  55. set @test_int=10,@test_double=1e-10,@test_string="abcdeghi",@test_string2="abcdefghij",@select=NULL;
  56. select @test_int,@test_double,@test_string,@test_string2,@select;
  57. @test_int @test_double @test_string @test_string2 @select
  58. 10 1e-10 abcdeghi abcdefghij NULL
  59. set @test_int="hello",@test_double="hello",@test_string="hello",@test_string2="hello";
  60. select @test_int,@test_double,@test_string,@test_string2;
  61. @test_int @test_double @test_string @test_string2
  62. hello hello hello hello
  63. set @test_int="hellohello",@test_double="hellohello",@test_string="hellohello",@test_string2="hellohello";
  64. select @test_int,@test_double,@test_string,@test_string2;
  65. @test_int @test_double @test_string @test_string2
  66. hellohello hellohello hellohello hellohello
  67. set @test_int=null,@test_double=null,@test_string=null,@test_string2=null;
  68. select @test_int,@test_double,@test_string,@test_string2;
  69. @test_int @test_double @test_string @test_string2
  70. NULL NULL NULL NULL
  71. select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
  72. @t1:=(@t2:=1)+@t3:=4 @t1 @t2 @t3
  73. 5 5 1 4
  74. explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3;
  75. id select_type table type possible_keys key key_len ref rows Extra
  76. 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
  77. Warnings:
  78. Note 1003 select sql_no_cache (@t1:=((@t2:=1) + (@t3:=4))) AS `@t1:=(@t2:=1)+@t3:=4`,(@t1) AS `@t1`,(@t2) AS `@t2`,(@t3) AS `@t3`
  79. select @t5;
  80. @t5
  81. 1.23456
  82. CREATE TABLE t1 (c_id INT(4) NOT NULL, c_name CHAR(20), c_country CHAR(3), PRIMARY KEY(c_id));
  83. INSERT INTO t1 VALUES (1,'Bozo','USA'),(2,'Ronald','USA'),(3,'Kinko','IRE'),(4,'Mr. Floppy','GB');
  84. SELECT @min_cid:=min(c_id), @max_cid:=max(c_id) from t1;
  85. @min_cid:=min(c_id) @max_cid:=max(c_id)
  86. 1 4
  87. SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid;
  88. c_id c_name c_country
  89. 1 Bozo USA
  90. 4 Mr. Floppy GB
  91. SELECT * FROM t1 WHERE c_id=@min_cid OR c_id=@max_cid OR c_id=666;
  92. c_id c_name c_country
  93. 1 Bozo USA
  94. 4 Mr. Floppy GB
  95. ALTER TABLE t1 DROP PRIMARY KEY;
  96. select * from t1 where c_id=@min_cid OR c_id=@max_cid;
  97. c_id c_name c_country
  98. 1 Bozo USA
  99. 4 Mr. Floppy GB
  100. drop table t1;
  101. set GLOBAL max_join_size=10;
  102. set max_join_size=100;
  103. show variables like 'max_join_size';
  104. Variable_name Value
  105. max_join_size 100
  106. show global variables like 'max_join_size';
  107. Variable_name Value
  108. max_join_size 10
  109. set GLOBAL max_join_size=2000;
  110. show global variables like 'max_join_size';
  111. Variable_name Value
  112. max_join_size 2000
  113. set max_join_size=DEFAULT;
  114. show variables like 'max_join_size';
  115. Variable_name Value
  116. max_join_size 2000
  117. set GLOBAL max_join_size=DEFAULT;
  118. show global variables like 'max_join_size';
  119. Variable_name Value
  120. max_join_size HA_POS_ERROR
  121. set @@max_join_size=1000, @@global.max_join_size=2000;
  122. select @@local.max_join_size, @@global.max_join_size;
  123. @@local.max_join_size @@global.max_join_size
  124. 1000 2000
  125. select @@identity, length(@@version)>0;
  126. @@identity length(@@version)>0
  127. 0 1
  128. select @@VERSION=version();
  129. @@VERSION=version()
  130. 1
  131. select last_insert_id(345);
  132. last_insert_id(345)
  133. 345
  134. explain extended select last_insert_id(345);
  135. id select_type table type possible_keys key key_len ref rows Extra
  136. 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
  137. Warnings:
  138. Note 1003 select sql_no_cache last_insert_id(345) AS `last_insert_id(345)`
  139. select @@IDENTITY,last_insert_id(), @@identity;
  140. @@IDENTITY last_insert_id() @@identity
  141. 345 345 345
  142. explain extended select @@IDENTITY,last_insert_id(), @@identity;
  143. id select_type table type possible_keys key key_len ref rows Extra
  144. 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
  145. Warnings:
  146. Note 1003 select sql_no_cache 345 AS `@@IDENTITY`,last_insert_id() AS `last_insert_id()`,345 AS `@@identity`
  147. set big_tables=OFF, big_tables=ON, big_tables=0, big_tables=1, big_tables="OFF", big_tables="ON";
  148. set global concurrent_insert=2;
  149. show variables like 'concurrent_insert';
  150. Variable_name Value
  151. concurrent_insert 2
  152. set global concurrent_insert=1;
  153. show variables like 'concurrent_insert';
  154. Variable_name Value
  155. concurrent_insert 1
  156. set global concurrent_insert=0;
  157. show variables like 'concurrent_insert';
  158. Variable_name Value
  159. concurrent_insert 0
  160. set global concurrent_insert=DEFAULT;
  161. select @@concurrent_insert;
  162. @@concurrent_insert
  163. 1
  164. set global timed_mutexes=ON;
  165. show variables like 'timed_mutexes';
  166. Variable_name Value
  167. timed_mutexes ON
  168. set global timed_mutexes=0;
  169. show variables like 'timed_mutexes';
  170. Variable_name Value
  171. timed_mutexes OFF
  172. set storage_engine=MYISAM, storage_engine="HEAP", global storage_engine="MERGE";
  173. show local variables like 'storage_engine';
  174. Variable_name Value
  175. storage_engine MEMORY
  176. show global variables like 'storage_engine';
  177. Variable_name Value
  178. storage_engine MRG_MYISAM
  179. set GLOBAL query_cache_size=100000;
  180. set GLOBAL myisam_max_sort_file_size=2000000;
  181. show global variables like 'myisam_max_sort_file_size';
  182. Variable_name Value
  183. myisam_max_sort_file_size 1048576
  184. set GLOBAL myisam_max_sort_file_size=default;
  185. show variables like 'myisam_max_sort_file_size';
  186. Variable_name Value
  187. myisam_max_sort_file_size FILE_SIZE
  188. set global net_retry_count=10, session net_retry_count=10;
  189. set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
  190. set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
  191. show global variables like 'net_%';
  192. Variable_name Value
  193. net_buffer_length 1024
  194. net_read_timeout 300
  195. net_retry_count 10
  196. net_write_timeout 200
  197. show session variables like 'net_%';
  198. Variable_name Value
  199. net_buffer_length 2048
  200. net_read_timeout 600
  201. net_retry_count 10
  202. net_write_timeout 500
  203. set session net_buffer_length=8000, global net_read_timeout=900, net_write_timeout=1000;
  204. show global variables like 'net_%';
  205. Variable_name Value
  206. net_buffer_length 1024
  207. net_read_timeout 900
  208. net_retry_count 10
  209. net_write_timeout 1000
  210. show session variables like 'net_%';
  211. Variable_name Value
  212. net_buffer_length 7168
  213. net_read_timeout 600
  214. net_retry_count 10
  215. net_write_timeout 500
  216. set net_buffer_length=1;
  217. show variables like 'net_buffer_length';
  218. Variable_name Value
  219. net_buffer_length 1024
  220. set net_buffer_length=2000000000;
  221. show variables like 'net_buffer_length';
  222. Variable_name Value
  223. net_buffer_length 1048576
  224. set character set cp1251_koi8;
  225. show variables like "character_set_client";
  226. Variable_name Value
  227. character_set_client cp1251
  228. select @@timestamp>0;
  229. @@timestamp>0
  230. 1
  231. set @@rand_seed1=10000000,@@rand_seed2=1000000;
  232. select ROUND(RAND(),5);
  233. ROUND(RAND(),5)
  234. 0.02887
  235. show variables like '%alloc%';
  236. Variable_name Value
  237. query_alloc_block_size 8192
  238. query_prealloc_size 8192
  239. range_alloc_block_size 2048
  240. transaction_alloc_block_size 8192
  241. transaction_prealloc_size 4096
  242. set @@range_alloc_block_size=1024*16;
  243. set @@query_alloc_block_size=1024*17+2;
  244. set @@query_prealloc_size=1024*18;
  245. set @@transaction_alloc_block_size=1024*20-1;
  246. set @@transaction_prealloc_size=1024*21-1;
  247. select @@query_alloc_block_size;
  248. @@query_alloc_block_size
  249. 17408
  250. show variables like '%alloc%';
  251. Variable_name Value
  252. query_alloc_block_size 17408
  253. query_prealloc_size 18432
  254. range_alloc_block_size 16384
  255. transaction_alloc_block_size 19456
  256. transaction_prealloc_size 20480
  257. set @@range_alloc_block_size=default;
  258. set @@query_alloc_block_size=default, @@query_prealloc_size=default;
  259. set transaction_alloc_block_size=default, @@transaction_prealloc_size=default;
  260. show variables like '%alloc%';
  261. Variable_name Value
  262. query_alloc_block_size 8192
  263. query_prealloc_size 8192
  264. range_alloc_block_size 2048
  265. transaction_alloc_block_size 8192
  266. transaction_prealloc_size 4096
  267. SELECT @@version LIKE 'non-existent';
  268. @@version LIKE 'non-existent'
  269. 0
  270. SELECT @@version_compile_os LIKE 'non-existent';
  271. @@version_compile_os LIKE 'non-existent'
  272. 0
  273. set big_tables=OFFF;
  274. ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
  275. set big_tables="OFFF";
  276. ERROR 42000: Variable 'big_tables' can't be set to the value of 'OFFF'
  277. set unknown_variable=1;
  278. ERROR HY000: Unknown system variable 'unknown_variable'
  279. set max_join_size="hello";
  280. ERROR 42000: Incorrect argument type to variable 'max_join_size'
  281. set storage_engine=UNKNOWN_TABLE_TYPE;
  282. ERROR 42000: Unknown table engine 'UNKNOWN_TABLE_TYPE'
  283. set storage_engine=MERGE, big_tables=2;
  284. ERROR 42000: Variable 'big_tables' can't be set to the value of '2'
  285. show local variables like 'storage_engine';
  286. Variable_name Value
  287. storage_engine MEMORY
  288. set SESSION query_cache_size=10000;
  289. ERROR HY000: Variable 'query_cache_size' is a GLOBAL variable and should be set with SET GLOBAL
  290. set GLOBAL storage_engine=DEFAULT;
  291. ERROR 42000: Variable 'storage_engine' doesn't have a default value
  292. set character_set_client=UNKNOWN_CHARACTER_SET;
  293. ERROR 42000: Unknown character set: 'UNKNOWN_CHARACTER_SET'
  294. set collation_connection=UNKNOWN_COLLATION;
  295. ERROR HY000: Unknown collation: 'UNKNOWN_COLLATION'
  296. set character_set_client=NULL;
  297. ERROR 42000: Variable 'character_set_client' can't be set to the value of 'NULL'
  298. set collation_connection=NULL;
  299. ERROR 42000: Variable 'collation_connection' can't be set to the value of 'NULL'
  300. set global autocommit=1;
  301. ERROR HY000: Variable 'autocommit' is a SESSION variable and can't be used with SET GLOBAL
  302. select @@global.timestamp;
  303. ERROR HY000: Variable 'timestamp' is a SESSION variable
  304. set @@version='';
  305. ERROR HY000: Variable 'version' is a read only variable
  306. set @@concurrent_insert=1;
  307. ERROR HY000: Variable 'concurrent_insert' is a GLOBAL variable and should be set with SET GLOBAL
  308. set @@global.sql_auto_is_null=1;
  309. ERROR HY000: Variable 'sql_auto_is_null' is a SESSION variable and can't be used with SET GLOBAL
  310. select @@global.sql_auto_is_null;
  311. ERROR HY000: Variable 'sql_auto_is_null' is a SESSION variable
  312. set myisam_max_sort_file_size=100;
  313. ERROR HY000: Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
  314. set @@SQL_WARNINGS=NULL;
  315. ERROR 42000: Variable 'sql_warnings' can't be set to the value of 'NULL'
  316. set autocommit=1;
  317. set big_tables=1;
  318. select @@autocommit, @@big_tables;
  319. @@autocommit @@big_tables
  320. 1 1
  321. set global binlog_cache_size=100;
  322. set bulk_insert_buffer_size=100;
  323. set character set cp1251_koi8;
  324. set character set default;
  325. set @@global.concurrent_insert=1;
  326. set global connect_timeout=100;
  327. select @@delay_key_write;
  328. @@delay_key_write
  329. ON
  330. set global delay_key_write="OFF";
  331. select @@delay_key_write;
  332. @@delay_key_write
  333. OFF
  334. set global delay_key_write=ALL;
  335. select @@delay_key_write;
  336. @@delay_key_write
  337. ALL
  338. set global delay_key_write=1;
  339. select @@delay_key_write;
  340. @@delay_key_write
  341. ON
  342. set global delayed_insert_limit=100;
  343. set global delayed_insert_timeout=100;
  344. set global delayed_queue_size=100;
  345. set global flush=1;
  346. set global flush_time=100;
  347. set insert_id=1;
  348. set interactive_timeout=100;
  349. set join_buffer_size=100;
  350. set last_insert_id=1;
  351. set global local_infile=1;
  352. set long_query_time=100;
  353. set low_priority_updates=1;
  354. set max_allowed_packet=100;
  355. set global max_binlog_cache_size=100;
  356. set global max_binlog_size=100;
  357. set global max_connect_errors=100;
  358. set global max_connections=100;
  359. set global max_delayed_threads=100;
  360. set max_heap_table_size=100;
  361. set max_join_size=100;
  362. set max_sort_length=100;
  363. set max_tmp_tables=100;
  364. set global max_user_connections=100;
  365. select @@max_user_connections;
  366. @@max_user_connections
  367. 100
  368. set global max_write_lock_count=100;
  369. set myisam_sort_buffer_size=100;
  370. set net_buffer_length=100;
  371. set net_read_timeout=100;
  372. set net_write_timeout=100;
  373. set global query_cache_limit=100;
  374. set global query_cache_size=100;
  375. set global query_cache_type=demand;
  376. set read_buffer_size=100;
  377. set read_rnd_buffer_size=100;
  378. set global rpl_recovery_rank=100;
  379. set global server_id=100;
  380. set global slow_launch_time=100;
  381. set sort_buffer_size=100;
  382. set @@max_sp_recursion_depth=10;
  383. select @@max_sp_recursion_depth;
  384. @@max_sp_recursion_depth
  385. 10
  386. set @@max_sp_recursion_depth=0;
  387. select @@max_sp_recursion_depth;
  388. @@max_sp_recursion_depth
  389. 0
  390. set sql_auto_is_null=1;
  391. select @@sql_auto_is_null;
  392. @@sql_auto_is_null
  393. 1
  394. set @@sql_auto_is_null=0;
  395. select @@sql_auto_is_null;
  396. @@sql_auto_is_null
  397. 0
  398. set sql_big_selects=1;
  399. set sql_big_tables=1;
  400. set sql_buffer_result=1;
  401. set sql_log_bin=1;
  402. set sql_log_off=1;
  403. set sql_log_update=1;
  404. Warnings:
  405. Note 1315 The update log is deprecated and replaced by the binary log; SET SQL_LOG_UPDATE has been ignored
  406. set sql_low_priority_updates=1;
  407. set sql_max_join_size=200;
  408. select @@sql_max_join_size,@@max_join_size;
  409. @@sql_max_join_size @@max_join_size
  410. 200 200
  411. set sql_quote_show_create=1;
  412. set sql_safe_updates=1;
  413. set sql_select_limit=1;
  414. set sql_select_limit=default;
  415. set sql_warnings=1;
  416. set global table_open_cache=100;
  417. set storage_engine=myisam;
  418. set global thread_cache_size=100;
  419. set timestamp=1, timestamp=default;
  420. set tmp_table_size=100;
  421. set tx_isolation="READ-COMMITTED";
  422. set wait_timeout=100;
  423. set log_warnings=1;
  424. create table t1 (a int not null auto_increment, primary key(a));
  425. create table t2 (a int not null auto_increment, primary key(a));
  426. insert into t1 values(null),(null),(null);
  427. insert into t2 values(null),(null),(null);
  428. set global key_buffer_size=100000;
  429. select @@key_buffer_size;
  430. @@key_buffer_size
  431. 98304
  432. select * from t1 where a=2;
  433. a
  434. 2
  435. select * from t2 where a=3;
  436. a
  437. 3
  438. check table t1,t2;
  439. Table Op Msg_type Msg_text
  440. test.t1 check status OK
  441. test.t2 check status OK
  442. select max(a) +1, max(a) +2 into @xx,@yy from t1;
  443. drop table t1,t2;
  444. select @@xxxxxxxxxx;
  445. ERROR HY000: Unknown system variable 'xxxxxxxxxx'
  446. select 1;
  447. 1
  448. 1
  449. select @@session.key_buffer_size;
  450. ERROR HY000: Variable 'key_buffer_size' is a GLOBAL variable
  451. set ft_boolean_syntax = @@init_connect;
  452. ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
  453. set global ft_boolean_syntax = @@init_connect;
  454. ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of ''
  455. set init_connect = NULL;
  456. ERROR HY000: Variable 'init_connect' is a GLOBAL variable and should be set with SET GLOBAL
  457. set global init_connect = NULL;
  458. set ft_boolean_syntax = @@init_connect;
  459. ERROR HY000: Variable 'ft_boolean_syntax' is a GLOBAL variable and should be set with SET GLOBAL
  460. set global ft_boolean_syntax = @@init_connect;
  461. ERROR 42000: Variable 'ft_boolean_syntax' can't be set to the value of ''
  462. set global myisam_max_sort_file_size=4294967296;
  463. show global variables like 'myisam_max_sort_file_size';
  464. Variable_name Value
  465. myisam_max_sort_file_size MAX_FILE_SIZE
  466. set global myisam_max_sort_file_size=default;
  467. select @@global.max_user_connections,@@local.max_join_size;
  468. @@global.max_user_connections @@local.max_join_size
  469. 100 200
  470. set @svc=@@global.max_user_connections, @svj=@@local.max_join_size;
  471. select @@global.max_user_connections,@@local.max_join_size;
  472. @@global.max_user_connections @@local.max_join_size
  473. 100 200
  474. set @@global.max_user_connections=111,@@local.max_join_size=222;
  475. select @@global.max_user_connections,@@local.max_join_size;
  476. @@global.max_user_connections @@local.max_join_size
  477. 111 222
  478. set @@global.max_user_connections=@@local.max_join_size,@@local.max_join_size=@@global.max_user_connections;
  479. select @@global.max_user_connections,@@local.max_join_size;
  480. @@global.max_user_connections @@local.max_join_size
  481. 222 111
  482. set @@global.max_user_connections=@svc, @@local.max_join_size=@svj;
  483. select @@global.max_user_connections,@@local.max_join_size;
  484. @@global.max_user_connections @@local.max_join_size
  485. 100 200
  486. set @a=1, @b=2;
  487. set @a=@b, @b=@a;
  488. select @a, @b;
  489. @a @b
  490. 2 1
  491. set @@global.global.key_buffer_size= 1;
  492. ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size= 1' at line 1
  493. set GLOBAL global.key_buffer_size= 1;
  494. ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size= 1' at line 1
  495. SELECT @@global.global.key_buffer_size;
  496. ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
  497. SELECT @@global.session.key_buffer_size;
  498. ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
  499. SELECT @@global.local.key_buffer_size;
  500. ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key_buffer_size' at line 1
  501. set @tstlw = @@log_warnings;
  502. show global variables like 'log_warnings';
  503. Variable_name Value
  504. log_warnings 1
  505. set global log_warnings = 0;
  506. show global variables like 'log_warnings';
  507. Variable_name Value
  508. log_warnings 0
  509. set global log_warnings = 42;
  510. show global variables like 'log_warnings';
  511. Variable_name Value
  512. log_warnings 42
  513. set global log_warnings = @tstlw;
  514. show global variables like 'log_warnings';
  515. Variable_name Value
  516. log_warnings 1
  517. create table t1 (
  518. c1 tinyint,
  519. c2 smallint,
  520. c3 mediumint,
  521. c4 int,
  522. c5 bigint);
  523. show create table t1;
  524. Table Create Table
  525. t1 CREATE TABLE `t1` (
  526. `c1` tinyint(4) DEFAULT NULL,
  527. `c2` smallint(6) DEFAULT NULL,
  528. `c3` mediumint(9) DEFAULT NULL,
  529. `c4` int(11) DEFAULT NULL,
  530. `c5` bigint(20) DEFAULT NULL
  531. ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  532. drop table t1;
  533. set @arg00= 8, @arg01= 8.8, @arg02= 'a string', @arg03= 0.2e0;
  534. create table t1 as select @arg00 as c1, @arg01 as c2, @arg02 as c3, @arg03 as c4;
  535. show create table t1;
  536. Table Create Table
  537. t1 CREATE TABLE `t1` (
  538. `c1` bigint(20) DEFAULT NULL,
  539. `c2` decimal(65,30) DEFAULT NULL,
  540. `c3` longtext,
  541. `c4` double DEFAULT NULL
  542. ) ENGINE=MyISAM DEFAULT CHARSET=latin1
  543. drop table t1;
  544. SET GLOBAL MYISAM_DATA_POINTER_SIZE= 7;
  545. SHOW VARIABLES LIKE 'MYISAM_DATA_POINTER_SIZE';
  546. Variable_name Value
  547. myisam_data_pointer_size 7
  548. SET GLOBAL table_open_cache=-1;
  549. SHOW VARIABLES LIKE 'table_open_cache';
  550. Variable_name Value
  551. table_open_cache 1
  552. SET GLOBAL table_open_cache=DEFAULT;
  553. set character_set_results=NULL;
  554. select ifnull(@@character_set_results,"really null");
  555. ifnull(@@character_set_results,"really null")
  556. really null
  557. set names latin1;
  558. select @@have_innodb;
  559. @@have_innodb
  560. #
  561. set @test = @@query_prealloc_size;
  562. set @@query_prealloc_size = @test;
  563. select @@query_prealloc_size = @test;
  564. @@query_prealloc_size = @test
  565. 1
  566. create table t1 (a int);
  567. select a into @x from t1;
  568. Warnings:
  569. Warning 1329 No data - zero rows fetched, selected, or processed
  570. show warnings;
  571. Level Code Message
  572. Warning 1329 No data - zero rows fetched, selected, or processed
  573. drop table t1;
  574. set @@warning_count=1;
  575. ERROR HY000: Variable 'warning_count' is a read only variable
  576. set @@global.error_count=1;
  577. ERROR HY000: Variable 'error_count' is a read only variable
  578. set @@max_heap_table_size= 4294967296;
  579. select @@max_heap_table_size > 0;
  580. @@max_heap_table_size > 0
  581. 1
  582. set global max_heap_table_size= 4294967296;
  583. select @@max_heap_table_size > 0;
  584. @@max_heap_table_size > 0
  585. 1
  586. set @@max_heap_table_size= 4294967296;
  587. select @@max_heap_table_size > 0;
  588. @@max_heap_table_size > 0
  589. 1
  590. select @@character_set_system;
  591. @@character_set_system
  592. utf8
  593. set global character_set_system = latin1;
  594. ERROR HY000: Variable 'character_set_system' is a read only variable
  595. set @@global.version_compile_os='234';
  596. ERROR HY000: Variable 'version_compile_os' is a read only variable
  597. set character_set_filesystem=latin1;
  598. select @@character_set_filesystem;
  599. @@character_set_filesystem
  600. latin1
  601. set @@global.character_set_filesystem=latin2;
  602. set character_set_filesystem=latin1;
  603. select @@character_set_filesystem;
  604. @@character_set_filesystem
  605. latin1
  606. set @@global.character_set_filesystem=latin2;
  607. set character_set_filesystem=default;
  608. select @@character_set_filesystem;
  609. @@character_set_filesystem
  610. latin2
  611. set @@global.character_set_filesystem=default;
  612. select @@global.character_set_filesystem;
  613. @@global.character_set_filesystem
  614. binary
  615. set @old_sql_big_selects = @@sql_big_selects;
  616. set @@sql_big_selects = 1;
  617. show variables like 'sql_big_selects';
  618. Variable_name Value
  619. sql_big_selects ON
  620. set @@sql_big_selects = @old_sql_big_selects;
  621. set @@sql_notes = 0, @@sql_warnings = 0;
  622. show variables like 'sql_notes';
  623. Variable_name Value
  624. sql_notes OFF
  625. show variables like 'sql_warnings';
  626. Variable_name Value
  627. sql_warnings OFF
  628. set @@sql_notes = 1, @@sql_warnings = 1;
  629. show variables like 'sql_notes';
  630. Variable_name Value
  631. sql_notes ON
  632. show variables like 'sql_warnings';
  633. Variable_name Value
  634. sql_warnings ON
  635. select @@system_time_zone;
  636. @@system_time_zone
  637. #
  638. select @@version, @@version_comment, @@version_compile_machine,
  639. @@version_compile_os;
  640. @@version @@version_comment @@version_compile_machine @@version_compile_os
  641. # # # #
  642. select @@basedir, @@datadir, @@tmpdir;
  643. @@basedir @@datadir @@tmpdir
  644. # # #
  645. show variables like 'basedir';
  646. Variable_name Value
  647. basedir #
  648. show variables like 'datadir';
  649. Variable_name Value
  650. datadir #
  651. show variables like 'tmpdir';
  652. Variable_name Value
  653. tmpdir #
  654. select @@ssl_ca, @@ssl_capath, @@ssl_cert, @@ssl_cipher, @@ssl_key;
  655. @@ssl_ca @@ssl_capath @@ssl_cert @@ssl_cipher @@ssl_key
  656. # # # # #
  657. show variables like 'ssl%';
  658. Variable_name Value
  659. ssl_ca #
  660. ssl_capath #
  661. ssl_cert #
  662. ssl_cipher #
  663. ssl_key #
  664. select @@log_queries_not_using_indexes;
  665. @@log_queries_not_using_indexes
  666. 0
  667. show variables like 'log_queries_not_using_indexes';
  668. Variable_name Value
  669. log_queries_not_using_indexes OFF
  670. End of 5.0 tests
  671. set global binlog_cache_size =@my_binlog_cache_size;
  672. set global connect_timeout =@my_connect_timeout;
  673. set global delayed_insert_timeout =@my_delayed_insert_timeout;
  674. set global delayed_queue_size =@my_delayed_queue_size;
  675. set global flush =@my_flush;
  676. set global flush_time =@my_flush_time;
  677. set global key_buffer_size =@my_key_buffer_size;
  678. set global max_binlog_cache_size =default;
  679. set global max_binlog_size =@my_max_binlog_size;
  680. set global max_connect_errors =@my_max_connect_errors;
  681. set global max_delayed_threads =@my_max_delayed_threads;
  682. set global max_heap_table_size =@my_max_heap_table_size;
  683. set global max_insert_delayed_threads=@my_max_insert_delayed_threads;
  684. set global max_join_size =@my_max_join_size;
  685. set global max_user_connections =@my_max_user_connections;
  686. set global max_write_lock_count =@my_max_write_lock_count;
  687. set global myisam_data_pointer_size =@my_myisam_data_pointer_size;
  688. set global net_buffer_length =@my_net_buffer_length;
  689. set global net_write_timeout =@my_net_write_timeout;
  690. set global net_read_timeout =@my_net_read_timeout;
  691. set global query_cache_limit =@my_query_cache_limit;
  692. set global query_cache_type =@my_query_cache_type;
  693. set global rpl_recovery_rank =@my_rpl_recovery_rank;
  694. set global server_id =@my_server_id;
  695. set global slow_launch_time =@my_slow_launch_time;
  696. set global storage_engine =@my_storage_engine;
  697. set global thread_cache_size =@my_thread_cache_size;