On Tue, 4 May 2004 11:01:59 -0400
"Tucker, Gabriel" <[EMAIL PROTECTED]> wrote:

> Luciano
> 
> I am confused...  As far as I can tell, the set
> foreign_key_checks=0; is used with the load data infile command.  

Actually, I think that it is used for all operations on the DBMS, not just load data 
infile, INSERTS, UPDATES, DELETES as well.  This is usually what I do when I have a 
dump created with mysqldump and need to re-create the tables.  What would be nicer is 
if mysqldump had some smarts to dump things in the right order so this would not be an 
issue.  Or course, the logic to do that would be kind of complex, always having to 
dump the weakest tables (those with foreign keys) first.  :)

> I
> am not using this command to restore the database.  The mysqldump
> command creates a file with the data and schema.  I restore it to a
> new instance that just has the mysql database using:
>     unix$> mysql --port=port --socket=socket -p < archive.sql
> 
> So, I am not sure where I would insert this line nor if it would
> work.  Should I insert it in the   "archive.sql" from the previous
> example?
> 
> Can I use the load data infile to restore the file I generated?
> 
> Also, in the mysqldump command I used the "--disable-keys" command,
> believing this would correct the problem.  Do you know why it does
> not?

This disables the keys during each INSERT block, but once the INSERT's are done, then 
it tries to enable the keys, so you will still get problems.  --disable-keys is meant 
more as an optimization.  The recommendation to set foreign_key_checks=0 at the start 
of the dump file, then set foreign_key_checks=1 at the end of the dump file should 
work just fine, has for me anyway.

Josh

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to