登录退出
mysql -uroot -p123456 #以root用户登录,键入密码名123456
quit #退出
查看MySQL信息
select version();#查看版本
数据库操作
show databases; #查看数据库
use test; #进入test数据库/切换数据库
select database(); #查看当前使用的数据库
show tables; #查看test数据库下的表
show create table test; #查看test的建表语句
desc table; #查看表结构
CRUD
insert into test values(xxx, xxx); #插入一条信息
update test set xxx='xxx' where id=2; #修改信息
delete from test where id>3; #删除一条信息
select #忽略