0

How to recreate db during import of the dump? By recreate, db drop or deletion of its data is meant.

mysql db -u root -p < dump.sql

It's possible of course to drop and create db manually or automate it using bash, but as import is run frequently, i would like it to be done automatically via mysql command if it's possible.

asked Jun 25, 2017 at 21:12

2 Answers 2

1

You need to add this mysql command in order to drop and create database in a dump script:

DROP DATABASE IF EXISTS `database_name`;
CREATE DATABASE `database_name`;
Anthony Genovese
2,0673 gold badges22 silver badges34 bronze badges
answered Jun 26, 2017 at 14:35
0
mysqldump ... --add-drop-database ...

Check out the vast number of other options, too.

answered Jul 5, 2017 at 9:57

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.