Skip to content

Instantly share code, notes, and snippets.

@intelguasoft
Last active April 23, 2020 06:03
Show Gist options
  • Select an option

  • Save intelguasoft/6d08560d990f4d2b4c32aca9fe11c5ae to your computer and use it in GitHub Desktop.

Select an option

Save intelguasoft/6d08560d990f4d2b4c32aca9fe11c5ae to your computer and use it in GitHub Desktop.
Create a MySQL database with charset UTF-8

Create a MySQL database with charset UTF-8

2019-10-29

As mentions in comments, utf8mb4_0900_ai_ci is the new default in MySQL 8.0, so the following is now again a better practice:

CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;

2019-10-29

Note: The following is now considered a better practice:

CREATE DATABASE mydatabase CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Try this:

CREATE DATABASE mydatabase CHARACTER SET utf8 COLLATE utf8_general_ci;

For more information, see Database Character Set and Collation in the MySQL Reference Manual.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment