List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:August 27 2002 9:01pm
Subject:Re: mysqldump on tables which use auto_increment
View as plain text  
use the -f option to ignore the duplicates.
Chris Barnes wrote:

>Hi,
>I have a database which a few tables which have a few fields set with
>auto_increment and i'm having alot of trouble restoring the backup because
>the backup recreates the table with the auto_increment field, but when it
>tries to enter the data back into the table it cant because it is trying to
>manually enter the value for the field with the auto_increment.
>
>here's a sample of the backup sql...
>
>CREATE TABLE ships (
>  ship_id bigint(20) unsigned NOT NULL auto_increment,
>  ship_name varchar(20),
>  ship_destroyed enum('Y','N') DEFAULT 'N' NOT NULL,
>  character_name varchar(20) DEFAULT '' NOT NULL,
>  password varchar(16) DEFAULT '' NOT NULL,
>
>now here's a sample of the data it will try to enter into the table....
>
># Dumping data for table 'ships'
>#
>
>LOCK TABLES ships WRITE;
>INSERT INTO ships VALUES (1,'WebMaster','N','WebMaster','admin@xxxxxxxxxx');
>UNLOCK TABLES;
>
>if i try to restore the database from this data it always tells me there was
>an error because it is trying to insert a duplicate value.
>
>dos anyone know how to properly backup and restore a table with
>auto_increment fields? or am i on the completely wrong track here?
>
>any help appreciated.
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread118078@stripped>
>To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
RE: mysqldump on tables which use auto_incrementChris Barnes27 Aug
  • Re: mysqldump on tables which use auto_incrementGerald Clark28 Aug