MySQL system variables and status variables have two scopes.
These are GLOBAL and SESSION which are self explanatory.
This is important to realize when altering system variables
dynamically. The following example does not produce the expected
results.
mysql> USE test; Database changed mysql> CREATE TABLE example1( -> id INT UNSIGNED NOT NULL AUTO_INCREMENT, -> col1 VARCHAR(10) NOT NULL, -> PRIMARY KEY(id) -> ); Query OK, 0 rows affected (0.29 sec) mysql> SHOW CREATE TABLE example1\G *************************** 1. row *************************** Table: example1 Create Table: CREATE TABLE `example1` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `col1` varchar(10) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 1 row in set (0.00 sec)
We see that the table has a default CHARACTER SET of latin1. If you wanted to ensure all tables are …
[Read more]