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?
Use the --no-data switch with mysqldump to tell it not to dump the data, only the table structure. This will output the CREATE TABLE statement for the tables. To target specific tables, enter them after the database name.
Mysqldump is a command-line utility that is used to generate the logical backup of the MySQL database. It produces the SQL Statements that can be used to recreate the database objects and data. The command can also be used to generate the output in the XML, delimited text, or CSV format.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With