Skip to content

Instantly share code, notes, and snippets.

@jzelenkov
Created April 3, 2011 20:43
Show Gist options
  • Save jzelenkov/900788 to your computer and use it in GitHub Desktop.
Save jzelenkov/900788 to your computer and use it in GitHub Desktop.
mysql utf8 support
# mysqld my.ini config (to adjust the mysql connection properties)
[mysql]
# sets mysql connection to use utf8 on the client side per default.
default-character-set=utf8
[mysqld]
# sets mysql connection to use utf8 on the server side per default.
character-set-server=utf8
collation-server=utf8_general_ci
# you also need to change charsets of all databases which were created before those values were set. All new tables created in that database will use new charset.
ALTER DATABASE dbname DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
# set mysql connection to use utf8 on the client side. Valid only for current session.
SHOW VARIABLES LIKE '%character_set%';
SET character_set_client=utf8;
SET character_set_connection=utf8;
SET character_set_database=utf8;
SET character_set_results=utf8;
SET character_set_server=utf8;
SET character_set_system=utf8;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment