Continuing on from preparation in our MySQL latin1 to utf8 migration let us first understand where MySQL uses character sets. MySQL defines the character set at 4 different levels for the structure of data.
- Instance
- Schema
- Table
- Column
In MySQL 5.1, the default character set is latin1. If not specified, this is what you will get. For example.
mysql> create table test1(c1 varchar(10) not null); mysql> show create table test1\G Create Table: CREATE TABLE `test1` ( `c1` varchar(10) NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1
If you want all tables in your instance to always be a default of
utf8, you can changed the server variable
character_set_server
. This can be set dynamically.
mysql> set global …[Read more]