forums › forums › SQLyog › Using SQLyog › Convert To Unicode
- This topic is empty.
-
AuthorPosts
-
-
June 24, 2007 at 9:53 pm #10416
Alan Sawyer
MemberI have been given the task of converting 5 MYSQL databases to unicode.
I have not done this before.
Is there an easy way to do this by exporting and importing or something like that.
Any help would be appreciated.
Alan
-
June 25, 2007 at 7:55 am #24392
peterlaursen
Participant1) yes you can simple export with SQLyog, and open the file in a text editor and change 'create database …' to 'create database … charset utf8 [collate ….]' and import again. Now the database will be created with the specified charset and not the server default charset. Be sure that there is no different CHARSET definition in the CREATE TABLE statements (just delete 'DEFAULT CHARSET …' for every table and tables will be created with database default
2) you can also use ALTER TABLE for every table.
first ALTER TABLE … charset utf8 (changes the table default)
next change the charset/collation for every column in SQLyog ALTER TABLE dialogue (this will re-encode existing data)
.. but teh default charset for the database will still be the old one. So whenever you want to create a unicode table the charset must be specified explicitly.
You may also want to change the server default from a non-unicode charset to utf8. This you do by editing my.ini/my.cnf
-
June 25, 2007 at 7:55 am #24393
peterlaursen
Participant1) yes you can simple export with SQLyog, and open the file in a text editor and change 'create database …' to 'create database … charset utf8 [collate ….]' and import again. Now the database will be created with the specified charset and not the server default charset. Be sure that there is no different CHARSET definition in the CREATE TABLE statements (just delete 'DEFAULT CHARSET …' for every table and tables will be created with database default
2) you can also use ALTER TABLE for every table.
first ALTER TABLE … charset utf8 (changes the table default)
next change the charset/collation for every column in SQLyog ALTER TABLE dialogue (this will re-encode existing data)
.. but teh default charset for the database will still be the old one. So whenever you want to create a unicode table the charset must be specified explicitly.
You may also want to change the server default from a non-unicode charset to utf8. This you do by editing my.ini/my.cnf
-
June 25, 2007 at 10:01 am #24394
Alan Sawyer
MemberThanks for the information. I will try it out.
Alan
-
-
AuthorPosts
- You must be logged in to reply to this topic.