At 12:44 +0200 10/25/02, Natale Babbo wrote:
>i tried it ... but nothing to do!
>when mysql parse the foreign key in the create table i
>get the error.
>perhaps i'm wronging in restoring tables/db!
>i use this method:
>shell> mysql -u <user> -p<password> < <dump file>
>is it wrong?
- DId you add the SET FOREIGN_KEY_CHECKS = 0; statement to the dump
- What version of MySQL do you have?
If you added the statement, and you have a recent enough version of
MySQL, then it will work not only for the INSERT statements in the
dump file, but for the CREATE TABLE statements as well.
> --- Victoria Reznichenko
><victoria.reznichenko@stripped> ha scritto: >
>> Friday, October 25, 2002, 10:08:00 AM, you wrote:
>> NB> ok ... that's right for data (insert into ...)
>> ... but
>> NB> i get the error before ... when mysql try to
>> NB> child table:
>> NB> CREATE TABLE ... idParent BIGINT, INDEX
>> NB> (idParent), FOREIGN KEY (idParent) REFERENCES
>> NB> parent(id)
>> NB> .. when mysql parses the foreign key, parent
>> NB> doesn't exist yet!
>> No, it's true not only for data.
>> SET FOREIGN_KEY_CHECKS=0;
>> in the dump file and then restore tables. It works
>> fine for me.
>> NB> --- Victoria Reznichenko
>> NB> <victoria.reznichenko@stripped> ha scritto: >
>> NB> Natale,
>> >> Thursday, October 24, 2002, 10:57:00 AM, you
>> >> NB> Anyone knows how to backup innodb tables in
>> >> right
>> >> NB> sql order?
>> >> NB> ... i mean ... to allow restoring correctly
>> >> NB> without foreign key constraint violation (if
>> >> the
>> >> NB> backup file ddl code for the child table is
>> >> before ddl
>> >> NB> code for the parent table i get an error).
>> >> You can set up SET FOREIGN_KEY_CHECKS=0, in this
>> >> case foreign key
>> >> constraints will not be checked. It's supported
>> >> since 3.23.52 and
> > >> 4.0.3