Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change server variable character_set_server

I want to change the mysql server variable character_set_server to utf8. I have googled on this but can't seem to find the information I'm looking for or the instructions don't match. It seems I need to edit a file called my.cnf but this file does not exist on my system. The version is 5.1.36.

like image 980
grai Avatar asked Aug 09 '11 10:08

grai


2 Answers

this is first result from google

http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_character-set-server

there are two ways to set this configuration

  • via configuration file (character-set-server), required restart
  • or via set global/session character_set_server, this does not require restart, BUT if your database restarted, it will gone, then you will need to set this again
like image 183
ajreal Avatar answered Oct 26 '22 15:10

ajreal


Locations of the my.ini and my.cnf files:

http://dev.mysql.com/doc/refman/5.0/en/option-files.html

As to the question whether you should use my.ini or my.cnf files, the above documentation states that

Windows systems use both my.ini and my.cnf,

Linux, Unix, Mac OS X systems use my.cnf.

like image 22
Paul Gobée Avatar answered Oct 26 '22 15:10

Paul Gobée