简体   繁体   中英

how to export database from mysql with empty tables?

I have a database in .sql format, while restore the database to localhost all tables have unknown data. how can i delete all tables data before or after import.

i am using windows 7. mysql server 5.5

You could use this query to export database with no data:

mysqldump -u[USERNAME] -p[PASSWORD] --add-drop-table --no-data [DATABASE]

You can also look at other options [here .] 1

phpmyadmin has an option for this task.

Select the database, you wish to export with empty tables

Click on Export

Select Custom in Export Method

Scroll down to Format-specfic options

Select Structure instead of Structure and data

Click on Go

That's all there is to it.

if you have access to PhpMyAdmin http://localhost/phpmyadmin/ on your localhost simply login and drop the tables in the database you wish to import SQL dumps.

Then import the SQL dump file (.sql)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM