Setting the UTF-8 for MySQL Installations on Linux

FlexNet Code Insight 6.13.2

This section explains how to set UTF-8 character encoding for MySQL Installations on Linux.

To set the UTF-8 character encoding for MySQL installations on Linux:

1. Ensure that you have a my.cnf file in your /etc/mysql directory

If you do not have a my.cnf file in your /etc/mysql directory, locate one of the following files in the /usr/share/mysql directory and copy it to /etc/mysql. Rename the file to my.cnf.

mysql-large.cnf (MySQL prior to 5.5)
my-large.cnf (MySQL 5.5 to 5.6)
my-default.cnf (MySQL 5.6+)
2. To change the default encoding to UTF-8, navigate to the /etc/mysql/my.cnf file, and edit the file as follows:

[client]

#password = [your_password]

port = 3306

socket = /var/lib/mysql/mysql.sock

default-character-set = utf8

 

[mysqld]

default-character-set = utf8

default-collation = utf8_general_ci

character-set-client = utf8

character-set-server = utf8

skip-character-set-client-handshake

3. To set the storage engine to InnoDB, edit the my.cnf file in the [mysqld] section.

default-storage-engine = INNODB

4. As an alternative, you may use the InnoDB plug-in.

Note • For more information, see: http://dev.mysql.com/doc/innodb-plugin/1.0/en/innodb-plugin-installation.html