I am using mysql database. I am using mysqldump to create a dump of my database. I want the database to be dumped such that there is a drop database if exists command followed by create database command. I am using the following command (on my sample database project).
mysqldump --skip-comments --compact --add-drop-database -uroot -proot project
I am getting the following result:
CREATE TABLE `names` (
`name` varchar(50) default NULL,
`year` varchar(5) default NULL,
`branch` varchar(50) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `names` VALUES ('Venkat','4-1','cse'),('rambabu','4-1','cse'),('nagesh','4-2','cse'),('ganesh','4-2','cse'),('rajesh','3-2','cse'),('ramesh','3-2','cse'),('sasirekha','3-1','cse'),('leela','3-1','cse');
CREATE TABLE `store` (
`name` varchar(50) default NULL,
`branch` varchar(50) default NULL,
`year` varchar(50) default NULL,
`feedback` varchar(500) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `store` VALUES ('nagesh','CSE','4-2','feedback for nagesh'),('ganesh','CSE','4-2','his performance is good. his behaviour is good.'),('rajesh','CSE','3-2','feedback of rajesh2'),('ramesh','CSE','3-2','feedback of ramesh'),('rajesh','CSE','3-2','feedback of rajesh'),('ramesh','CSE','3-2','feedback of ramesh'),('Venkat','CSE','4-1','feedback of venkat'),('rambabu','CSE','4-1','feedback of rambabu');
As you can see, i do not have the drop database and create database syntax here. What am i doing wrong?? MySqlServer ver: 14.12 Distrib 5.0.45
try this: mysqldump --skip-comments --compact --add-drop-database -uroot -proot --databases project