Changing the collation of your database

Overview

You can change a database's collation by running an SQL statement over SSH or from a MySQL client such as MySQL Workbench. Some website software requires a specific collation, so you may need to change it depending on the software your site uses.

How do I change the database collation?

  1. Connect to your database via SSH or with MySQL Workbench.

  2. Run the following, replacing database with your database name and utf8mb4_unicode_ci with the collation you need:

    mysql> ALTER DATABASE database COLLATE utf8mb4_unicode_ci;

The new collation applies to tables created afterwards. To convert an existing table as well, run the following for each table:

mysql> ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

See also

This form is only for article feedback. If you require assistance, please contact support. Do not include passwords, account numbers, or other private account details.

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?