Skip to main content

How to Change a MySQL Database Character Set or Collation Safely

You can change the character set or collation of a MySQL or MariaDB database to ensure your website displays special characters, symbols, and non-English characters correctly. This process is performed by a customer using a database management tool...

You can change the character set or collation of a MySQL or MariaDB database to ensure your website displays special characters, symbols, and non-English characters correctly. This process is performed by a customer using a database management tool like phpMyAdmin.

Important: Changing the character set or collation can affect how your application interprets data. If your application is not configured to match the new database settings, it may result in "mojibake" (garbled text) or broken characters. Always perform a full database backup before making structural changes.

Before you begin

You will need:

  • Access to your Hostek account

  • Access to phpMyAdmin

  • A full backup of the database you intend to modify

Changing the database character set

  1. Log in to your Hostek control panel.

  2. Open the database management tool (e.g., phpMyAdmin).

  3. Select the database from the list on the left.

  4. Click the Operations tab in the top menu.

  5. Locate the Collation section at the bottom of the page.

  6. Select the desired character set and collation from the dropdown menu.

  7. Click Go to apply the changes.

Confirm the result

  • The page will refresh and display a success message confirming the collation has been updated.

  • You can verify the change by clicking the SQL tab and running the command: SHOW VARIABLES LIKE 'character_set_database';

  • The result should reflect the new character set you selected.

If you see "garbled" text after the change

If your website displays incorrect characters after the change, the application's configuration file (such as wp-config.php for WordPress) may still be attempting to connect using the old character set.

  1. Access your website's root directory via your file manager or FTP.

  2. Locate your application's configuration file.

  3. Ensure the database connection strings match the new character set.

  4. If you are unsure of the correct settings for your specific application, contact Hostek support for guidance on the required configuration.

Limitations

  • This procedure only changes the database-level settings. It does not automatically update the configuration files of your website's software (e.g., WordPress, Joomla, or a custom script).

  • Changing the collation of a database that already contains data may not automatically convert existing data to the new format; it only affects how new data is handled and how the database interprets existing data.

Did this answer your question?