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

前端 未结 5 1603
遥遥无期
遥遥无期 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:30

    I'm not a MySQL expert by any means but the following site suggests using the -d or --no-data option of mysqldump:

    mysqldump -d -h localhost -u root -pmypassword databasename > dumpfile.sql
    

    It worked for me.

提交回复
热议问题