FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

convert the entire database's collation to utf8_general_ci

 


Mgccl
anyone got a query that can change every table and every field's collation that is latin1_swedish_ci to utf8_general_ci?
I have a lot tables and fields and I need to do it manually one by one in phpmyadmin, that could cost me like 3 days.


BTW it's mysql version 4.1

thanks in advance
vinx_18
TRY this:

ALTER TABLE `table_name` CHANGE `field_name` `field_name` TYPE CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL


Note:

Just copy and paste it.
Change the table_name to its corresponding correct table name.
Change the field_name to its corresponding correct field name.
Change the type to its corresponding type lke VARCHAR (20)..etc.
You may omit the NOT null at the last.
Also, you may run it in php script by a for loop or while loop...store all field names and table names in an array.

Smile
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.