Operations on Logical Databases

When using database languages, be sure to end with a semicolon ( ; )
1. Create a database
CREATE DATABASE database name;
CREATE DATABASE Scores;//Create a database with the specified name, and the character set uses the "specified character set when installing the database";

CREATE DATABASE database name CHARACTER SET character set;
CREATE DATABASE scores02 CHARACTER SET GBK; # Create a database with the specified name and set the specified character set;

2. View the database
SHOW DATABASES; #View "all" databases in the database MySql server, note: "DATABASES" is used here instead of "DATABASE";

SHOW CREATE DATABASE database name;
SHOW CREATE DATABASE scores; #View the information when a database is defined;

3. Delete the database
DROP DATABASE database name;
DROP DATABASE scores;

4. Use the database
View the database in use
SELECT DATABASE();

USE database name; switch database.
USE student;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325955271&siteId=291194637