mysql -u root -p -e "CREATE DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

Category: Databases & SQL

mysql -u root -p -e "CREATE DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"

Create a database with explicit charset

utf8mb4 is the full Unicode character set, and utf8mb4_unicode_ci is its accent-insensitive collation; setting both explicitly avoids legacy latin1 defaults. Newer MySQL defaults already use utf8mb4, but being explicit protects MariaDB and older servers.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.