首页 > Sql-Mysql > Mysql只导出表结构,不要数据 – Mysql导出

Mysql只导出表结构,不要数据 – Mysql导出

现在想把服务器上的mysql的表结构复制到本地,不需要数据。而且没有phpmyadmin等可视化工具,只能通过语句导出结构。

那么在mysql命令行内,使用以下语句即可:


SHOW CREATE DATABASE db_name //获取数据库结构 db_name是数据库名字
SHOW CREATE TABLE tbl_name  //获取表的结构 tbl_name是表的名字

即可获取到创建数据库或者表结构的语句,在本地执行即可。

此外,show 还有很多的功能,列在下边。

SHOW [FULL] COLUMNS FROM tbl_name [FROM db_name] [LIKE 'pattern']
SHOW CREATE DATABASE db_name
SHOW CREATE FUNCTION funcname
SHOW CREATE PROCEDURE procname
SHOW CREATE TABLE tbl_name
SHOW DATABASES [LIKE 'pattern']
SHOW ENGINE engine_name ...{LOGS | STATUS }
SHOW [STORAGE] ENGINES
SHOW ERRORS [LIMIT [offset,] row_count]
SHOW FUNCTION STATUS [LIKE 'pattern']
SHOW GRANTS FOR user
SHOW INDEX FROM tbl_name [FROM db_name]
SHOW INNODB STATUS
SHOW PROCEDURE STATUS [LIKE 'pattern']
SHOW [BDB] LOGS
SHOW PLUGIN
SHOW PRIVILEGES
SHOW [FULL] PROCESSLIST
SHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern']
SHOW TABLE STATUS [FROM db_name] [LIKE 'pattern']
SHOW [OPEN] TABLES [FROM db_name] [LIKE 'pattern']
SHOW TRIGGERS
SHOW [GLOBAL | SESSION] VARIABLES [LIKE 'pattern']
SHOW WARNINGS [LIMIT [offset,] row_count]
The SHOW statement also has forms that provide information about
replication master and slave servers and are described in
[replication-sql]:
SHOW BINLOG EVENTS
SHOW MASTER LOGS
SHOW MASTER STATUS
SHOW SLAVE HOSTS
SHOW SLAVE STATUS
  1. 佛山物流公司 6月 16th, 2011 @ 12:31 | #1

    恭喜发财

  2. 匿名 10月 16th, 2014 @ 11:42 | #2

    想问下 怎么在.net下查看mysql表结构呢?

  3. 匿名 10月 16th, 2014 @ 11:47 | #3

    请问net下怎么查看mysql表结构呢

评论提交中, 请稍候...

留言

可以使用的标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Trackbacks & Pingbacks ( 0 )
  1. 还没有 trackbacks