[size=medium]一直以来都有好多的语句在用,但是有时候又会突然忘记,在这里做个小结:
1、显示MySQL的建表语句
show create table tablename;
2、获取表的字段信息
show columns from tablename;//desc tablename;
3、查询数据库当前编码
show variables like "character_set%";
4、导入.sql文件命令(例如 d:\mysql.sql)
use database;
source d:/mysql.sql;
5、将查询结果保存到文件
select title from book into outfile '/tmp/outfile.txt';
[/size]
1、显示MySQL的建表语句
show create table tablename;
2、获取表的字段信息
show columns from tablename;//desc tablename;
3、查询数据库当前编码
show variables like "character_set%";
4、导入.sql文件命令(例如 d:\mysql.sql)
use database;
source d:/mysql.sql;
5、将查询结果保存到文件
select title from book into outfile '/tmp/outfile.txt';
[/size]