Reconfigure my MySQL server for utf8 support

Darryl Clarke smartssa at gmail.com
Wed Feb 15 03:04:14 UTC 2006


On 14/02/06, Dave M G <martin at autotelic.com> wrote:
> Ubuntu Users,
>
>     I installed MySQL on my Ubuntu system via Synaptic. In other words,
> I used a GUI point and click interface, and saw nothing of configuration
> options.
>
>     Now, I find that what I want to do is change all the system
> variables related to encoding and collation to use utf8.
>
>     I have gained some advice from the MySQL mailing list, and the manual:
>     http://dev.mysql.com/doc/refman/4.1/en/charset-server.html
>
>     Apparently, one can reconfigure MySQL using ./configure or something
> like that to rebuild (?) the server so that it has utf8 as the default
> encoding.
>
>     But, my stumbling block is that the advice I've got on the MySQL
> mailing list and in the manual assumes that one is comiling from source
> and not simply obtaining from a repository. There is also an assumption
> of knowledge about what is being configured and where to run the commands.
>
>     I am not so knowledgeable. I'm a newbie who is in over my head.
>
>     Since I got my MySQL through Synaptic and the Ubuntu repositories, I
> have no idea where or how to run configuration commands. All I know is
> that I want *all* the following variables to be set *permanently* to utf-8.
>
>     Can someone give me a beginners rundown on how to do this?
>
>     These are the relevant variables:
>
> Variable        Session value        Global value
> character set client        utf8       latin1
> character set connection     utf8     latin1
> character set database     latin1     latin1
> character set results     utf8     latin1
> character set server     latin1     latin1
> character set system     utf8     utf8
> collation connection     utf8_general_ci     latin1_swedish_ci
> collation database     latin1_swedish_ci     latin1_swedish_ci
> collation server     latin1_swedish_ci     latin1_swedish_ci
>
>     Any advice would be much appreciated.
>
>     Thank you.

Hi!

Edit /etc/mysql/my.cnf

Locate the section that starts [mysqld]

And add these lines under it:
# utf8
init-connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_general_ci

Should do it for you.

--
~ Darryl  ~ smartssa at gmail.com
~ http://darrylclarke.com




More information about the ubuntu-users mailing list