0

I have one database that needs to be converted from latin_1 to utf8. This conversion is no problem and in my staging environments, everything works correctly when I add to my.cnf the lines (as suggested in this SO question):

[client]
default-character-set = utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

And run the appropriate ALTER statements:

ALTER TABLE {row} CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Unfortunately, this database doesn't sit on the MySQL server alone. It shares the server with a couple databases still using the latin_1 encodings and these databases really have no need to be utf8. Can I have different encodings share the same server and do I need to alter the default configuration to do this? Or is this asking for trouble?

Community
  • 1
  • 1
AndrewJesaitis
  • 480
  • 4
  • 15
  • Should be no problem. We have a developer machine with many databases, some UTF-8 and Some Latin 1. – Atle May 10 '13 at 17:01

1 Answers1

3

The encoding of the actual data is on a per-column basis, i.e. every single column in every table could have a different encoding. The data is transcoded on the fly to/from the connection encoding each individual client has; each client can have a different connection encoding and each client can change the connection encoding on the fly. You do not need to change anything in the config files; in fact you shouldn't, since this may influence the behavior of clients relying on the default.

Just set your own encoding settings for your client and you're good. Read this for more details.

deceze
  • 510,633
  • 85
  • 743
  • 889