【MySQL】操作命令
MySQL 基本操作命令
MySQL 基本操作命令
- 查看所有数据库
 show databases;
- 使用数据库
 use xxx;
- 创建数据库
 create database xxx charset=utf8;//创建xx数据库,并指定编码
- 查看创建数据库时的语法命令
 show create database xxx;
- 查看数据库中所有的表
 show tables;
- 删除数据库
 drop database xxx;
- 查看所有触发器
 show triggers;
- 查看指定表触发器(使用 \G 切换视图为纵向输出)
 select * from information_schema.triggers where EVENT_OBJECT_TABLE=’table_name’;
- 删除触发器
 drop trigger trigger_name;
- 查看表结构
 desc table;
 describe table;
- 创建视图
 create view view_name as select column1[…] from table where [condition];
- 删除视图
 drop view name;
MySQL 5.5版本注意
- 没有 datatime,如需要使用时间戳,用timestmap代替
- 默认使用分号;结束判断,如果需要多行输入,将delimiter ; 更改为delimiter //,按“//”为结束判断
- 没有 datetime ,时间戳使用 timestamp
原文作者: ma xiaozhou
原文链接: https://maxiaozhou1234.github.io/sqlite/mysql-cmd/
版权声明: 转载请注明出处(必须保留原文作者署名原文链接)