Configuring MySQL 5 general options: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
 
Line 7: Line 7:


  # [client]
  # [client]
  # character_set_client=utf8
  # default-character-set=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:
* 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:

Latest revision as of 16:25, 19 September 2006

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]
# default-character-set=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