0

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

3
  • What is the machine you are doing this on? Server, Shared hosting? local machine - windows/unix or mac? Commented Jan 8, 2015 at 9:17
  • i am using windows 7 Commented Jan 8, 2015 at 9:35
  • Just run the command I wrote in the answer on the command prompt. Commented Jan 9, 2015 at 10:00

3 Answers 3

5

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.

Sign up to request clarification or add additional context in comments.

Comments

2

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

1 Comment

Alright, I understand you've just started with MySQL. You can run this command on Command prompt on windows or Terminal on mac.
1

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)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.