Mysql的基本语句

时间:2017-11-26 23:37:03   收藏:0   阅读:298

Mysql的基本语句

1.查询当前数据库所有表名:

-- 方案一:
show tables;

--方案二:jeesite为数据库
select table_name from information_schema.tables where table_schema=jeesite and table_type=base table;

2,查询某张表的所有字段名:

-- jeesite为数据库名,sys_role为表名
select column_name from information_schema.columns where table_schema=jeesite and table_name=sys_role;

3,查询mysql支持哪些存储引擎:

show engines;

4,查看mysql当前默认的存储引擎:

 show variables like %storage_engine%;

5,备份一个数据库【在windows cmd 下面使用】

mysqldump -h hostname -P port -u username -p dbname table1 table2 ... > d:\BackupName.sql

其中:

例如:使用root用户备份jeesite数据库下的fr_t_user表

mysqldump -u root -p jeesite fr_t_user > D:\mysql\backup\mysql20171126.sql

6,使用mysqldump命令 还原数据库的语法如下【在windows cmd 下面使用】:

 mysql -hlocalhost -P3306 -uroot -p  dbname  <  d:\mysql\backup\mysql20171126.sql

 

原文:http://www.cnblogs.com/lizm166/p/7900955.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!