Mysql - UTF8 ONLY: Difference between revisions
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
Edit my.cnf |
Edit my.cnf |
||
<pre> |
<pre> |
||
[ |
[mysqld] |
||
collation_server=utf8_unicode_ci |
collation_server=utf8_unicode_ci |
||
character_set_server=utf8 |
character_set_server=utf8 |
Latest revision as of 13:33, 3 June 2009
Configuring MySQL to only use UTF8
Only works for non-super users!!!!!
This is for databases only running UTF8
Edit my.cnf
[mysqld] collation_server=utf8_unicode_ci character_set_server=utf8 [mysql] default-character-set=utf8 [mysqldump] default-character-set=utf8 ########### OLD ################# ## [Client] - Add default-character-set=utf8 ## [Mysqld] - Add default-character-set=utf8 init_connect='SET NAMES utf8' character-set-server = utf8 collation-server = utf8_general_ci
After edit, check everything is ok
Login via web/console and do the following query:
mysql> show variables like 'character_set%'; show variables like 'collation%'; +--------------------------+----------------------------+ | 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/ | +--------------------------+----------------------------+ 8 rows in set (0.00 sec) +----------------------+-----------------+ | Variable_name | Value | +----------------------+-----------------+ | collation_connection | utf8_general_ci | | collation_database | utf8_general_ci | | collation_server | utf8_general_ci | +----------------------+-----------------+
If you do not get the above, then check if you're logging in as admin user (Teh init-command is NOT executed then - must be a non-priviledges user or use SET NAMES utf8 manually if admin)