Configuring MySQL 5 general options

From Elvanör's Technical Wiki
Revision as of 15:09, 19 September 2006 by Elvanor (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This article is a short guide for specifying general MySQL options. In particular it focuses on setting up UTF-8 properly on MySQL 5 hosted on a UNIX system.


Where are the configuration files?

  • The general configuration file is in /etc/my.cnf. In particular general client options (when I mean client, I mean the mysql program) should be set here under the [client] section. So to use utf-8 as the general character set for client connections, include the following lines in /etc/my.cnf:
# [client]
# character_set_client=utf8
  • In the data directory of your MySQL installation (for example /usr/local/mysql/data) there can also be a my.cnf file, which can set up various server options. For example the following sets up utf-8 as the default server encoding:
# [mysqld]
# character_set_server=utf8

See also