i want to use mysqldump so that it includes the statement to create database if not exists, and drop database if exists. is this possible? what options can I use?
Asked
Active
Viewed 2.3k times
2 Answers
3
You can get MYSQLDump to drop the database before creating it by adding
--add-drop-database
To your MYSQLDump command. You should already have the create database command in there.

Sam Cogan
- 38,736
- 6
- 78
- 114
-
how do I make create table statement use namespace(db name) – user12145 Jan 29 '11 at 15:56
-
Only to correct the source code client/mysqldump.c. mysqldump add 'USE `DBNAME`;' statement. – alvosu Jan 29 '11 at 16:11
-
2'IF NOT EXIST' added, if --databases or --all-databases option was given. – alvosu Jan 29 '11 at 16:13