This is a discussion on Encoding within the MySQL Database forums, part of the Database Forums category; I have moved DB from one to another machine, but I forgot to set up the encoding of databases, so ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have moved DB from one to another machine, but I forgot to set up the
encoding of databases, so some of them are wrong. Is it possible to change database/table/column encoding without a need of exporting data, re-create the database and importing the data? Marek Simon, Prague, Czech Republic |
|
|||
|
Marek Simon wrote:
> I have moved DB from one to another machine, but I forgot to set up the > encoding of databases, so some of them are wrong. Is it possible to > change database/table/column encoding without a need of exporting data, > re-create the database and importing the data? > Marek Simon, Prague, Czech Republic run this for your data abase: ALTER DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_persian_ci then run this for each table already in the database : ALTER TABLE table_XXX CONVERT TO CHARACTER SET utf8 COLLATE utf8_persian_ci; replace collation and/or character set as appropriate |
|
|||
|
lark schrieb:
> > ALTER TABLE table_XXX CONVERT TO CHARACTER SET utf8 COLLATE > utf8_persian_ci; > > replace collation and/or character set as appropriate Wouldn't you have to alter the column definitions as well? IIRC altering the table would only change the defaults for columns that are added without specifying a character set and collation. Regards, Jo |
|
|||
|
>> ALTER TABLE table_XXX CONVERT TO CHARACTER SET utf8 COLLATE
>> utf8_persian_ci; > > Wouldn't you have to alter the column definitions as well? > IIRC altering the table would only change the defaults for columns that > are added without specifying a character set and collation. That is exactly what the above statement does. If you only want to change the default, use something like: ALTER TABLE table_XXX CHARACTER SET=utf8; -- Willem Bogaerts Application smith Kratz B.V. http://www.kratz.nl/ |
![]() |
| Thread Tools | |
| Display Modes | |
|
|