If your database displays garbled characters or encoding errors, the collation of one or more tables may need to be changed. phpMyAdmin lets you update the collation for individual tables.
Steps to Change Table Collation
- Log in to your cPanel account.
- Navigate to the Databases section and click phpMyAdmin.
- In the left-hand panel, click the database that contains the table you want to modify.
- Click the table name to select it (the table contents will be displayed).
- Click the Operations tab at the top of the page.
- Under Table options, locate the Collation drop-down menu.
- Select the desired collation (e.g.
utf8mb4_general_cifor modern Unicode support, orutf8mb4_unicode_cifor more accurate sorting). - Click Go in the Table options section. A confirmation message will appear once the collation is updated.
Important Notes
- Changing a table’s collation does not automatically convert existing data. If your data is already corrupted, you may also need to convert the column collations individually.
utf8mb4is the recommended character set for modern applications as it supports the full Unicode range (including emojis). The olderutf8(3-byte) is a legacy option.- The database itself should have a matching collation. You can set the database collation from the Operations tab of the database (not the table).
Troubleshooting
- Characters still garbled after change: The data itself may have been stored with incorrect encoding. You may need to convert the data using an SQL query such as
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - Collation drop-down is missing: Make sure you are on the Operations tab of the table (not the database). The table must be selected first.