Zhixian's Tech Blog

2010-07-11

Set MySql default collation to UTF8

Filed under: computing, database, web application development — Tags: , , , , , , — Zhixian @ 02:06:07 am

One of the bad thing about installing MySql using Ubuntu Software Center is that it does not allow you to select the default collation of MySql Server. This is one of the nice things you would find in the Windows version of MySql installer.

In any case, to set MySql collation to use UTF8, all you have to do is:

  1. Edit your MySql configuration file (typically found at /etc/mysql/my.cnf)
  2. Under the section [mysqld]add the following lines:
    # utf8
    init-connect=’SET NAMES utf8′
    character-set-server=utf8
    collation-server=utf8_general_ci
  3. Restart your MySql
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: