I am trying to upload a backup sql file through phpMyAdmin.
create the empty db with the same db name as in my import file in phpMyAdmin then use the import function selected from within this empty db.
I get the following error message.
#1050 - Table '`db`.`t`' already exists
Inside the import file each CREATE TABLE
statement is suffixed by IF NOT EXISTS
, so why is this being reported as an error?
--
-- Database: `mbfour`
--
-- --------------------------------------------------------
--
-- Table structure for table `cars`
--
CREATE TABLE IF NOT EXISTS `cars` (
`car_id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(200) NOT NULL,
`status` varchar(20) NOT NULL,
`capacity` varchar(5) NOT NULL,
PRIMARY KEY (`car_id`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `cars`
--
INSERT INTO `cars` (`car_id`, `type`, `status`, `capacity`) VALUES
(1, 'automatic', 'built', '4L'),
(2, 'automatic', 'in-production', '2L'),
(3, 'automatic', 'built', '2L'),
(4, 'automatic', 'in-production', '4L');
....
....
Is There Any Magic Happens???
After Trying Two Times Then I Import like same Way, It works
Thanks Folks.....
To remove a table in MySQL, use the DROP TABLE statement. The basic syntax of the command is as follows: DROP [TEMPORARY] TABLE [IF EXISTS] table_name [, table_name] [RESTRICT | CASCADE];
To do delete a database you need the command 'DROP DATABASE'. The syntax is similar to creating a database. 'DROP DATABASE <name>;', where <name> is the name of the database you want to delete. The mysql-console is not very helpful here.
Please add this at the top of every query:
DROP TABLE IF EXISTS `cars`;
CREATE TABLE IF NOT EXISTS `cars`
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With