跳到主要内容

RENAME DATABASE

Changes the name of a database.

Syntax

ALTER DATABASE [ IF EXISTS ] <name> RENAME TO <new_db_name>

Examples

CREATE DATABASE DATABEND;
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| DATABEND |
| INFORMATION_SCHEMA |
| default |
| system |
+--------------------+
ALTER DATABASE `DATABEND` RENAME TO `NEW_DATABEND`;
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| NEW_DATABEND |
| default |
| system |
+--------------------+