1、连接mysql
mysql -u root -p 然后输入密码
2、创建数据库(数据库名字为:test_base)
create database test_base;
3、删除数据库
drop database test_base;
4、选择数据库
use test_base;
5、给test_base数据库创建一张表
先借用一个复杂点的表说明
CREATE TABLE IF NOT EXISTS runoob_tbl(
-> runoob_id INT NOT NULL AUTO_INCREMENT,
-> runoob_title VARCHAR(100) NOT NULL,
-> runoob_author VARCHAR(40) NOT NULL,
-> submission_date DATE,
-> PRIMARY KEY ( runoob_id )
-> )ENGINE=InnoDB DEFAULT CHARSET=utf8;
创建简单的表

6、查看表
show tables;
7、查看表的内容
desc student_tbl;
8、删除表
drop table student_tbl;
9、插入数据
insert into student_tbl (student_name, student_age) values ('张三','18');
10、查询数据
查询所有数据
select * from student_tbl;
查询某条数据
select * from student_tbl where student_id=1;
11、修改数据
update student_tbl set student_age = "20" where student_id = 1;
12、删除数据
delete from student_tbl where student_id=1;