总结:
系统级操作:
服务器的启停
mysql服务,通过系统服务来操作,或:
net start mysql
net stop mysql
登录系统:
mysql -hlocalhost -uroot -p
退出:
quit
exit
客户端:
cmd方式:
phpmyadmin方式:
navicat方式:
库操作:
建库:
create database 数据库名 charset utf8;
删除数据库:
drop database 数据库名;
show databases;
show create database 数据库名;
use 数据库名;
表操作:
建表:
create table 表名 (
字段1 类型 [属性],
字段2 类型 [属性],
......
)
charset = 编码 engine =表类型名称
表类型有:InnoDB, MyIsam, BDB, Memory
desc 表名;
show create table 表名;
show tables;
drop table 表名;
alter table 修改表有如下可修改项:
alter table 表名 add 新的字段;
alter table 表名 change 旧字段 新字段;
alter table 表名 modify 修改字段;
alter table 表名 rename 新的表名;
alter table 表名 charset = 新的字符集名;
数据操作:
增:
insert into (字段列表) values (值列表);
删:
delete from 表名 where 条件;
改:
update 表名 set 字段名 = 新的值,..... where 条件
查:
select 字段列表 from 表名 where 条件。