How to change collation in MySQL
Sometimes when I do servers migrations for example from cPanel to Plesk I had some issues with databases collations because each control panel software has their default collation, so I had to manually change the collation of each database that I was going to import in the new server. Normally this happens when you have an latin1 database and you wish to change collation to a UTF8 database, or vice versa.
To do this you can change it from phpMyAdmin or via MySQL console.
Change collation via phpMyAdmin:
- Go to phpMyAdmin
- Select the database you want to change collation in your left pane

Select database in phpMyAdmin
- Click on the operation tab in the top menu of phpMyAdmin

phpMyAdmin Operations Option
- You will see the collation option, select the new collation from the drop down menu and then click on Go

phpMyAdmin collation
Change collation via MySQL console:
ALTER DATABASE `db` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
This will change the collation to latin1_swedish_ci
Note:
Remember that you have to do this before you import the data because this change will affect only the new tables created after we change the collation.
I hope that this little trick help you fix some issues with database driven websites that uses special characters in their content.
