Skip to main content
added 81 characters in body
Source Link
cecilli0n
  • 305
  • 1
  • 4
  • 9

I am trying to upload a backup sql file through phpMyAdmin.

I 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?

I have tried to take out the table reported from the sql file, but then the next table just throws up the error, and the next etc until we have a sql import with no tables left.

I am using Windows XP with MySQL 5.5.37-win32, these versions could be different from the versions used when creating the backup, would this matter?

Thanks in advance.

Edit : Added SQL code.

This is just a sample, the code is created by phpMyAdmin's export function

-- phpMyAdmin SQL Dump
-- version 4.1.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2014 at 07:24 PM
-- Server version: 5.6.15-log
-- PHP Version: 5.4.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- 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');
....
....

Much more sql data but seems pointless to post as it is all formatted the same.

I am trying to upload a backup sql file through phpMyAdmin.

I 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?

I have tried to take out the table reported from the sql file, but then the next table just throws up the error, and the next etc until we have a sql import with no tables left.

I am using Windows XP with MySQL 5.5.37-win32, these versions could be different from the versions used when creating the backup, would this matter?

Thanks in advance.

Edit : Added SQL code.

This is just a sample, the code is created by phpMyAdmin's export function

-- phpMyAdmin SQL Dump
-- version 4.1.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2014 at 07:24 PM
-- Server version: 5.6.15-log
-- PHP Version: 5.4.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- 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');
....
....

I am trying to upload a backup sql file through phpMyAdmin.

I 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?

I have tried to take out the table reported from the sql file, but then the next table just throws up the error, and the next etc until we have a sql import with no tables left.

I am using Windows XP with MySQL 5.5.37-win32, these versions could be different from the versions used when creating the backup, would this matter?

Thanks in advance.

Edit : Added SQL code.

This is just a sample, the code is created by phpMyAdmin's export function

-- phpMyAdmin SQL Dump
-- version 4.1.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2014 at 07:24 PM
-- Server version: 5.6.15-log
-- PHP Version: 5.4.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- 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');
....
....

Much more sql data but seems pointless to post as it is all formatted the same.

Tweeted twitter.com/#!/StackDBAs/status/454939588822573056
added 1502 characters in body
Source Link
cecilli0n
  • 305
  • 1
  • 4
  • 9

I am trying to upload a backup sql file through phpMyAdmin.

I 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?

I have tried to take out the table reported from the sql file, but then the next table just throws up the error, and the next etc until we have a sql import with no tables left.

I am using Windows XP with MySQL 5.5.37-win32, these versions could be different from the versions used when creating the backup, would this matter?

Thanks in advance.

Edit : Added SQL code.

This is just a sample, the code is created by phpMyAdmin's export function

-- phpMyAdmin SQL Dump
-- version 4.1.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2014 at 07:24 PM
-- Server version: 5.6.15-log
-- PHP Version: 5.4.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- 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');
....
....

I am trying to upload a backup sql file through phpMyAdmin.

I create the empty db 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?

I have tried to take out the table reported from the sql file, but then the next table just throws up the error, and the next etc until we have a sql import with no tables left.

I am using Windows XP with MySQL 5.5.37-win32, these versions could be different from the versions used when creating the backup, would this matter?

Thanks in advance.

I am trying to upload a backup sql file through phpMyAdmin.

I 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?

I have tried to take out the table reported from the sql file, but then the next table just throws up the error, and the next etc until we have a sql import with no tables left.

I am using Windows XP with MySQL 5.5.37-win32, these versions could be different from the versions used when creating the backup, would this matter?

Thanks in advance.

Edit : Added SQL code.

This is just a sample, the code is created by phpMyAdmin's export function

-- phpMyAdmin SQL Dump
-- version 4.1.4
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 03, 2014 at 07:24 PM
-- Server version: 5.6.15-log
-- PHP Version: 5.4.14

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- 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');
....
....
Source Link
cecilli0n
  • 305
  • 1
  • 4
  • 9

Table already exists error when trying to import sql file

I am trying to upload a backup sql file through phpMyAdmin.

I create the empty db 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?

I have tried to take out the table reported from the sql file, but then the next table just throws up the error, and the next etc until we have a sql import with no tables left.

I am using Windows XP with MySQL 5.5.37-win32, these versions could be different from the versions used when creating the backup, would this matter?

Thanks in advance.