Linux, MySQL

Enable Mysql UTF8 Support

To enable UTF8 support in server level:

1. First create a backup for file /etc/mysql/my.ini

2. Open /etc/mysql/my.ini file for editing

3. Locate [mysql] and [mysqld] and append the following lines:

[mysql]
default-character-set=utf8

[mysqld]
collation_server=utf8_unicode_ci
character_set_server=utf8
default-character-set=utf8
init_connect=’SET collation_connection = utf8_general_ci’
init_connect=’SET NAMES utf8′

4. Restart mysql

 

To enable UTF8 support in database level:

Create your database with the following sql command:

CREATE DATABASE [database_name] DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;