[MySQL learning articles] ---Add, delete, check and modify the library

[MySQL learning articles]-add, delete, check and modify the library

Create a database named test

Comments are marked with '#'

# create database 库名; 
CREATE DATABASE test;

#创建一个库,并且 指定编码格式
#create database 库名 character set utf8/gbk;
CREATE DATABASE test CHARACTER SET utf8;

Delete the database named test

# drop database 库名;
DROP DATABASE test;

Inquire

Query the detailed information of the specified library

#show create database 库名;
SHOW CREATE DATABASE test;

Library information

Query how many databases there are under MySQL

SHOW DATABASES;

Query which database the current user is connected to

SELECT DATABASE();

View which tables are in the specified database

SHOW TABLES;

Select the specified database for operation

# use 库名
use test;

modify

Modify the specified library code

#alter database 库名 character set 新编码;
ALTER DATABASE test CHARACTER SET gbk;

Guess you like

Origin blog.csdn.net/DREAM_yao/article/details/107914610