Question
How to change MySQL servers default charset from "utf8_unicode_ci" to "utf8mb4_unicode_ci"?
Answer
This feature is not yet implemented in Plesk.
If you would like to see this feature in Plesk, please vote for it on Plesk UserVoice:
By default, Plesk databases are created with the following command:
CREATE DATABASE
/*!40101 default charset=utf8 */
databasename
As a workaround, apply the following solution:
-
Connect to a Plesk server via SSH.
-
Create the file
/root/dbscript.sh
with the following content:#!/bin/sh
db=${NEW_DATABASE_NAME}
plesk db "ALTER DATABASE $db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci"
-
Set the correct permissions:
# chmod 0775 /root/dbscript.sh
- In Plesk, go to Tools & Settings > Event Manager and click Add Event Handler.
-
Choose the event type to be Database created, put the following in the command section and press OK:
/root/dbscript.sh