(Edit 2: Information has come in, thankfully. It’s only accessed via ODBC, where I can set connection charset to match anything I set for the MySQL database. So this whole question is reduced to: If I set connection charset of both ODBC and database to UTF-8, am I done and it will not corrupt the data? (server/database charset is latin1). I will happily accept a simple yes or no with a short explanation why.
————— the rest is original background information, not really relevant anymore.————–
(Edit: to clarify: the data is already imported correctly, this is ONLY a question about connection charset.)
I’m trying to make a decision whether to change the connection character set to that of collation and server for my newly created MySQL database.
The server and collation charsets for it are set to the same as that of the old server running MySQL 4.1 – latin1. Some data is already imported with mysql.exe and is verified as correct.
The connection character set was not changed from the default UTF-8 when the server admin installed MySQL 5.5 and created the new database at one point in time.
The old server reported no variables set for collation or connection character set, so my questions are: (I’ve assumed the current setting, UTF-8, should be the most correct route)
- where to look for what to set it to (hints from experience)
- if I choose to set it to latin1, if scripts writing to the database somewhere could corrupt the data again
- or if it can be switched on and off at will without ever corrupting the data, i.e. if I can postpone the decision.
The database server admin doesn’t have the information to give me an answer, and with the information missing from the old database, I would like to make sure but can’t.
It’s a 1GB .sql file which has required gradual editing in TextPad to import, so it would save time to know if this is a critical setting.
My best plan at the moment is to not change the setting, import the data, and backup – and if a script corrupts data due to incorrectly set connection charset, the backup is restored. Do you see problems with this plan?
When migrating data,
set destination data charset+collation to the same as for the ancient MySQL database version. You may have to change Type= to Engine=, timestamp(xx) to timestamp, and some float(xx,xx) to double in the huge sqldump with f.ex. TextEdit before importing it with mysql.exe
Find out what, if any, connections will write to the tables and if their source charset differs from that of the database. If so, modify the datasource’s connection properties so that the connection converts the source data to the database charset.