Deployment of Ubuntu12.0.4Linux server: modifying MySQL character set 5.x Ubuntu
Go to the mysql installation directory and find the configuration file,/etc/mysql/my. cnf
Run the following command:
sudo vi my.cnf
Go to the modify configuration file,
1-under the [client] Node, add
# The default character set is utf8default-character-set = utf8
2-add it under the [mysqld] Node
# The default character set is utf8default-character-set = utf8 # set the encoding when connecting to mysql database, let mysql database for utf8 run init_connect = 'setnames utf8'
After modification, restart mysql and query it.
Use the following command
show variables like 'character%';
+ -------------------------- + ---------------------------- +
| Variable_name | Value |
+ -------------------------- + ---------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | utf8 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | utf8 |
| Character_set_system | utf8 |
| Character_sets_dir |/usr/share/mysql/charsets/|
+ -------------------------- + ---------------------------- +
Note: mysql 5.5
The solution is to add the following content under the [mysqld] configuration option in the my. cnf file.
character-set-server= utf8lower_case_table_names= 1