MySQL Database Character Encoding
Query to show MySQL database character encoding:
SELECT default_character_set_name FROM information_schema.SCHEMATA S WHERE schema_name = "db_name";
Create a new MySQL database with specified character encoding:
CREATE DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci;
/* To support emoji! */
CREATE DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
Query to change MySQL database character encoding:
ALTER DATABASE db_name CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER DATABASE db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;