How to Create a Database in MySQL

Last updated July 25, 2026 · By the SaturnSQL team

Use CREATE DATABASE with an explicit utf8mb4 character set so emoji and all of Unicode store correctly. Add IF NOT EXISTS to make setup scripts rerunnable.

CREATE DATABASE shop
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_0900_ai_ci;

Idempotent version

CREATE DATABASE IF NOT EXISTS shop CHARACTER SET utf8mb4;

MySQL 8.0 defaults to utf8mb4 anyway, but 5.7 defaults to latin1, so always state it. The utf8mb4_0900_ai_ci collation is 8.0-only; on 5.7 use utf8mb4_unicode_ci.

Run this in SaturnSQL

SaturnSQL is a browser-based SQL editor for teams: shared query library, schema-aware autocomplete, and scheduled exports to Google Sheets and Slack.

Try it free

Related MySQL guides

© 2026 Panda Capital Oy Ab. All rights reserved.