net start mysql
net stop mysql
mysql -u -p
show databases;
创建删除DB
drop database NAME;
create datebase NAME;
使用DB
use NAME;
show tables;
数据库操作:
create table name
(
id varchar(32) not null primary key,
name varchar(20) not null,
password varchar(20) not null
);
drop NAME;
查看表:
describe NAME;
其他:
delete from Name;
insert into Name values(,,);
select * from Name where=;
update Name set NAME="";
加载脚本:
source Path;@在Oracle中
INSERT INTO persion VALUES();
INSERT INTO persion VALUES();
INSERT INTO persion VALUES();
得到信息:
select version();
select current_data;
mysql中的计算:
select pi();
select sin();
查看用户:
select user();
--注释
加载:
load data local infile='Path' into table Name;
distinct关键字去掉重复行;
select distinct ...
select * from N where N is null;
模式匹配:
where String like ‘%NNN%’;
%是通配符;
计数:
select count(*) from Name;
mysql数据库的基本用法:
备份和恢复数据库:
mysqldump -u -p db>C:/file.sql
备份多个表:
mysqldump -u -p db table1 table2>C:/file.sql
备份所有的数据库:
mysqldump -u -p -all -database>C:/file.sql
数据库的恢复:
mysql -u root -p pwd mydb<d:/backup.sql