MySQL控制台
- help; //查看命令
- quit; //退出
- show //查看//显示
- show databases; //显示所有的数据库
- use ######; //选择数据库
- select * from tablename; //查询表的数据
- create database ######; //创建数据库
- drop database ######; //删除数据库
创建表
- create table tablename(
col_name type not null auto_increment,
col_name type default,
primary key(col_name)
);
例:
create table mytable(id int() auto_increment,
username varchar(30),
password varchar(30),
primary key(id)); - show tables; //显示表
- desc tablename; //查看表结构
- drop table #####; //删除表#####
- 插入表
insert into tablename(col_name,col_name,col_name)//类名
值 字符串 values(‘value1’,‘value2’,‘value3’,‘value4’,‘value5’); - 更新,修改数据
update tablename
set col_name = ‘value’,
col_name = ‘value’
where condition(条件); - 删除数据 d