0
votes

Using Xampp/MySQL. Exported win7 MySQL database. Import to another win10 machine with same Xampp/MySQL version. Made sure the "sc2" database did not exist in the Win10 setup (no directory). But during import, Workbench gave error of

"22:53:38 Restoring E:\Data\xampp\mysql\data\ExportDatabase14Jan2016-sc2\sc2.sql Running: mysql.exe --defaults-file="c:\users\henry\appdata\local\temp\tmp3le6eb.cnf" --protocol=tcp --host=127.0.0.1 --user=root --port=3306 --default-character-set=utf8 --comments < "E:\Data\xampp\mysql\data\ExportDatabase14Jan2016-sc2\sc2.sql" ERROR 1050 (42S01) at line 27: Table 'sc2.categories' already exists

Operation failed with exitcode 1 22:53:39 Import of E:\Data\xampp\mysql\data\ExportDatabase14Jan2016-sc2\sc2.sql has finished with 1 errors"

Tried several times deleting the directory ensuring the table "categories" did not exist, but get this message every time.

Line 27 section is:

CREATE TABLE `categories` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `categoryid_UNIQUE` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;

Don't see the problem here...

1
@OP Don't use sql file for backup. In past I got trouble like UTF-8 and ASCII and sometime file not restored. For better result try mysqldump. It make a GB backup/restore in seconds.Anirudha Gupta
Perhaps there is another create table statement for categories in the file.Shadow

1 Answers

0
votes

I took the SQL Import script and pasted it into Workbench's SQL execution area instead of using its import function. It seemed to have executed all the SQL statements OK without errors or warnings. Still not sure why using the import function kept giving me the "Table already exists" error. I had several other databases that imported fine using the function but not this particular database.