How to dump mysql table structure without data with a SQL query?

前端 未结 5 1674
遥遥无期
遥遥无期 2020-12-23 19:02

I need to export a mysql table, but it has like 5gb of entries, so I only want the structure. I am trying to do it from a simple php doing a sql query, how can I do that?

5条回答
  •  半阙折子戏
    2020-12-23 19:35

    You can use SHOW CREATE TABLE for this.

    Shows the CREATE TABLE statement that creates the given table. The statement requires the SELECT privilege for the table. As of MySQL 5.0.1, this statement also works with views.

    E.g.:

    SHOW CREATE TABLE MyTablename
    

提交回复
热议问题