MariaDBMySQLMySQL UpgradeTechnical3 comments MySQL 8 utf8mb4_0900_ai_ci collation confusionKedarNovember 18, 2024 Recently I was asked a question: Why am I getting utf8mb4_0900_ai_ci as the default collation in MySQL 8, despite setting the server to use utf8mb4_general_ci? With the upgrade to MySQL… View Post
3 responses to “MySQL 8 utf8mb4_0900_ai_ci collation confusion”
Its nice explanation Kedar. looking forward to your next blog
Hi Kedar,
Nice post 🙂
When you execute SET NAMES ‘utf8mb4’ COLLATE ‘utf8mb4_general_ci’, it sets the client character set and collation for the current session. However, this command does not change the server’s default collation for the database or tables unless explicitly specified in a create table statement.
The SET NAMES command primarily impacts how data is interpreted between the client and server during the session. Therefore, if no collation is explicitly mentioned in a create table statement, the server applies its default collation (e.g., utf8mb4_0900_ai_ci) to the new table.
Right. Aim was to look for follow the usual-thought-process and reach to the solution. I will borrow your explanation and add it to the post for those who won’t read the comments.
Thanks.