Checking a database’s default character set and collation prevents subtle text problems like broken emoji storage, unexpected sort order, and comparisons that behave differently across environments.
In MySQL and MariaDB, the server has global defaults, but each database (schema) can define its own default character set and collation. New tables and columns inherit these database defaults unless a table/column explicitly sets its own character set or collation.
The values shown here describe the database defaults only, not necessarily what existing tables or columns currently use. Results can be filtered by privileges (for example, schemas may be hidden without SHOW DATABASES), and output may contain version comments like /*!40100 ... */ that can be ignored. If utf8mb3 appears, it represents legacy 3-byte UTF-8 behavior, while utf8mb4 supports full Unicode.
$ mysql --user=root --password Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 112 Server version: 8.0.44 MySQL Community Server - GPL Copyright (c) 2000, 2025, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
mysql> SHOW CREATE DATABASE appdb\G
*************************** 1. row ***************************
Database: appdb
Create Database: CREATE DATABASE `appdb` /*!40100 DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci */ /*!80016 DEFAULT ENCRYPTION='N' */
1 row in set (0.00 sec)
Replace appdb with your database name, and use backticks around names with dashes or spaces.
mysql> SELECT
schema_name AS database_name,
default_character_set_name AS charset,
default_collation_name AS collation
FROM information_schema.schemata
ORDER BY schema_name;
+--------------------+---------+--------------------+
| database_name | charset | collation |
+--------------------+---------+--------------------+
| analytics | utf8mb4 | utf8mb4_0900_ai_ci |
| app | utf8mb4 | utf8mb4_0900_ai_ci |
| appdb | utf8mb4 | utf8mb4_0900_ai_ci |
| information_schema | utf8mb3 | utf8mb3_general_ci |
| mysql | utf8mb4 | utf8mb4_0900_ai_ci |
| performance_schema | utf8mb4 | utf8mb4_0900_ai_ci |
##### snipped #####
+--------------------+---------+--------------------+
Rows are commonly filtered by privileges, so the list may not include every schema on the server.
mysql> USE appdb; Database changed
mysql> SELECT
schema_name AS database_name,
default_character_set_name AS charset,
default_collation_name AS collation
FROM information_schema.schemata
WHERE schema_name = DATABASE();
+---------------+---------+--------------------+
| database_name | charset | collation |
+---------------+---------+--------------------+
| appdb | utf8mb4 | utf8mb4_0900_ai_ci |
+---------------+---------+--------------------+
1 row in set (0.00 sec)
DATABASE() returns the active schema name selected by USE.
mysql> SELECT
@@character_set_database AS charset,
@@collation_database AS collation;
+---------+--------------------+
| charset | collation |
+---------+--------------------+
| utf8mb4 | utf8mb4_0900_ai_ci |
+---------+--------------------+
1 row in set (0.00 sec)