Posts tagged How to change Collation from latin1_swedish_ci to utf8_general_ci

How to change Collation from latin1_swedish_ci to utf8_general_ci

If you want to change your database collation form from latin1_swedish_ci to utf8_general_ci then follow the below steps :

take the sql dump for the DB for which you want to change the collation :

example :

root@server[#] mysqldump --opt test_shop > test_shop.sql

Now in the .sql dump file search for the collation for latin :

root@server[#] cat test_shop.sql | grep -i latin1

now replace the latin collation to utf8 by running the command :

root@server[#] replace latin1 utf8 -- test_shop.sql

finally restore the changed .sql dump file (in ex : it is test_shop.sql)

root@server[#] mysql test_shop < test_shop.sql

That’s all you are done.