This topic describes how to create a database in an AnalyticDB for MySQL cluster by executing the CREATE DATABASE statement after you connect to the cluster. You can connect to the cluster by using Data Management Service (DMS), a MySQL client (such as Navicat for MySQL, DBeaver, DbVisualizer, and SQL Workbench/J), application code, or the MySQL command line tool.
In the following example, DMS is used to create a database.
- On the SQL INFORMATION_SCHEMA tab, enter the CREATE DATABASE statement in the SQL console to create a database.
CREATE DATABASE [IF NOT EXISTS] db_name
- Parameter description:
db_name: the database name. A database name can be up to 64 characters in length and can contain letters, digits, and underscores (_). It must start with a lowercase letter and cannot contain consecutive underscores (_).Note Do not use analyticdb as the database name. The name analyticdb is reserved for a built-in database.
create database adb_demo;
create database if not exists adb_demo2;
- In the upper-left corner, click execute(F8) to create the database.