MySql learning (1) CRUD operation of the database

CRUD operation of the database

First log in to the database server:

mysql -u(账号) -p(密码) (mysql -uroot -pmysql)

Exit the database server:

exit

Create a database :

create database 数据库名称;

 

When creating a database, specify the character set :

create database 数据库名称 character set utf8;
create database 数据库名称 character set utf8 collate 校对规则(utf8_bin);

See all databases:

show databases;

See the specified database:

show create database 数据库名称;

Modify the database operation:

alter database 数据库名称 character set gbk(修改数据库字符集);

Delete the database :

drop database 数据库名称;

Switch database ( select database):

use 数据库名称;

View the database currently in use :

select database();

 

Guess you like

Origin blog.csdn.net/liu362732346/article/details/103782443
Recommended