2.6.1.17. Change database charset

You can view the list of available charsets using the SQL query:
SHOW CHARACTER SET
  1. Connect to the database using phpMyAdmin or any MySQL client.
  2. To change the charset, execute the appropriate SQL query:
    ALTER DATABASE `database_name` COLLATE colation;
    SELECT @@collation_database;
    • database_name — specify the name of the database for which you need to change the collation.
    • collation — specify the desired collation, for example utf8mb4_unicode_ci.
    ALTER TABLE `table_name` COLLATE collation;
    • table_name — specify the name of the table for which you need to change the collation.
    • collation — specify the desired collation, for example utf8mb4_unicode_ci.
    ALTER TABLE `table_name` CHANGE `field_name` VARCHAR(40) CHARACTER SET charset COLLATE collation;
    • table_name — specify the name of the table in which you want to change the charset of the specified field.
    • field_name — specify the name of the field for which you need to change the charset.
    • charset — specify the required charset, for example utf8mb4.
    • collation — specify the desired collation, for example utf8mb4_unicode_ci.
Content

    (1)

    Comments

    constantin.ponomaryov
    трохи застаріла та трохи б доповнити, utf8mb4_0900_ai_ci
    karlov
    utf8mb4_0900_ai_ci підтримується на хостингу і його можна встановити за даною інструкцією. Чи ви маєте на увазі наявність такого варіанта при створенні бази даних?