How to change the collation of an existing MySQL database?
This is a Drupal 8 site
Currently my database is with collation utf8_general_ci
Is it possible to convert an existing database with collation utf8mb4_unicode_ci?
Is there a risk of damaging the database?
EDIT
Finally the tables are in the format utf8_general_ci
Why is it written in the "Operations" tab utf8_general_ci?
What is the difference between utf8mb4_general_ci and utf8mb4_unicode_ci?
Which "Collation" is currently recommended ?
You can use the ALTER DATABASE
query:
ALTER DATABASE databasename COLLATE utf8mb4_unicode_ci;
This just changes the default collation of the database, which is used when creating new tables, it doesn't modify any existing tables. However, the documentation mentions this caveat regarding stored routines:
If you change the default character set or collation for a database, stored routines that use the database defaults must be dropped and recreated so that they use the new defaults. (In a stored routine, variables with character data types use the database defaults if the character set or collation are not specified explicitly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With