2

My mysql server's current server character set is latin1. My server is started on startup via rc.conf setting mysql_enable="YES". How to set my server to use utf8 as the server character set?

2 Answers 2

3

I edited /etc/rc.conf and added the mysql_args line below:

mysql_enable="YES"
mysql_args="--character-set-server=utf8"

This works and I can see the server character set is updated.

1
  • I'd prefer a config file based solution but this is working for now
    – User
    Commented Sep 8, 2012 at 3:02
2

From the manual,

Specify character settings at server startup. To select a character set and collation at server startup, use the --character-set-server and --collation-server options.

You include the following in /usr/local/etc/my.cnf

[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci

(You could find samples of my.cnf in /usr/local/share/mysql)

More information on mysql

3
  • 1
    /etc/mysql doesn't exist on FreeBSD
    – User
    Commented Sep 8, 2012 at 2:43
  • @User that's a mistake, sorry. answer updated
    – daisy
    Commented Sep 8, 2012 at 2:55
  • I'm trying this but for some reason mysql doesn't want to start when the file is there. If I rename the file then mysql starts fine.
    – User
    Commented Sep 8, 2012 at 3:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .