Here we will cover how to change the character encoding and collation of databases, as well as changing the character encoding and collation of tables. These can be changed through phpMyAdmin or from the command line.
Changing the character encoding of a MySQL database is necessary if characters are used that are not included in the standard character set.
These methods can be used to change the character encoding to utf8, utf8_bin, utf8_general_ci, or any other collation type.
As always, it is strongly recommended to back up the database before making database changes like this.
Related Articles
Create Database Using MySQL Database Wizard
Import MySQL Database Using phpMyAdmin
Change Database Character Encoding
CAUTION: It is recommended to back up the database before making changes. Backing up a database can be done using phpMyAdmin or through SSH.
-
- Log into cPanel
- Navigate to phpMyAdmin, located in the Database section
- To update an entire database's collation setting
- Select your database from the list on the left
TIP: If you aren't sure which database the site is using, check the configuration file in the document root of the website. - Click on Operations from the top set of tabs:
- In the Collation box, choose your new collation from the dropdown menu
TIP: utf8_general_ci is the most common utf8 collation. - Click Go
TIP: In newer versions of phpMyAdmin, the Go button may be in the bottom-right of the Collation box.
- Select your database from the list on the left
- To update just one database table
- Select the table from the list on the left
- Click on Operations from the top set of tabs
- In Table options, under Collation, choose your new collation from the dropdown menu
- Click Go on the bottom right of the Table options box
- Select the table from the list on the left