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
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.
-
I'd prefer a config file based solution but this is working for now– UserCommented Sep 8, 2012 at 3:02
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
)
-
1
-
-
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.– UserCommented Sep 8, 2012 at 3:02