数据库的基本命令
1. 登录数据库
mysql -uroot -p
接着输入你root用户的密码
2. 基本命令的使用
2.1 查看mysql中有多少数据库
show databases;
2.2 创建一个名为school的数据库
create database school;
再查看下是否创建了school数据库
show databases;
2.3 使用名为mysql的数据库
use mysql;
2.4 查看名为mysql的数据库里面有多少表
show tables;
2.5 在名为school的数据库中,创建一个名为student的表,并查看创建出的student表
use school;
create table student(sid int, sname varchar(20));
show tables;
2.6 查看刚才创建出来的student表的信息
show create table student;
2.7 向student表中添加一个int类型的age并查看student表的信息
alter table student add age int;
show create table student;
2.8 删除student表中的age信息并查看
alter table student drop age;
show create table student;
2.9 删除student表并查看是否成功删除
drop table student;
show tables;
2.10 退出
exit