'#--------------------FN_DYNVARS_008_01-------------------------#' SET @global_character_set_database = @@global.character_set_database; SET @session_character_set_database = @@session.character_set_database; SET @session_character_set_server = @@session.character_set_server; SET @@global.character_set_database = utf8; 'connect (con1,localhost,root,,,,)' 'connection con1' SELECT @@global.character_set_database; @@global.character_set_database utf8 SELECT @@session.character_set_database; @@session.character_set_database latin1 'Bug#35356: session character_set_database differ from global character_set_database' '#--------------------FN_DYNVARS_008_02-------------------------#' 'connection default' DROP TABLE IF EXISTS t1; '--check if setting session character_set_database effects new databases' SET @@session.character_set_server = utf8; SELECT @@session.character_set_database; @@session.character_set_database latin1 SET @@session.character_set_database = latin5; SELECT @@session.character_set_database; @@session.character_set_database latin5 CREATE DATABASE db1; USE db1; SHOW CREATE DATABASE db1; Database Create Database db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET utf8 */ CREATE TABLE t1(a INT, b VARCHAR(40)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(40) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 DROP TABLE t1; DROP DATABASE db1; 'Bug#35357: character_set_database does not effects CREATE DATABASE without characater set' '--ascii character set specified--' CREATE DATABASE db1 CHARACTER SET ascii; USE db1; SHOW CREATE DATABASE db1; Database Create Database db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET ascii */ CREATE TABLE t1(a INT, b VARCHAR(40)); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, `b` varchar(40) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=ascii DROP TABLE t1; DROP DATABASE db1; '------Check if load data uses character_set_database----------' USE test; CREATE TABLE t1 (a CHAR(4) CHARACTER SET utf8) ENGINE=MyISAM CHARACTER SET utf8; 'Verify with latin'; SET @@session.character_set_database = latin1; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1; SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; count(*) 2433 TRUNCATE TABLE t1; 'Verify with utf8'; SET @@session.character_set_database = utf8; LOAD DATA INFILE 'MYSQLTEST_VARDIR/std_data_ln/charset_utf8.txt' INTO TABLE t1; SELECT count(*) FROM t1 WHERE CHAR_LENGTH(a)>1; count(*) 1 DROP TABLE IF EXISTS t1; SET @@global.character_set_database = @global_character_set_database; SET @@session.character_set_database = @session_character_set_database; SET @@session.character_set_server = @session_character_set_server;