MySQL and restore

F

Frank Aune

Hi,

Inspired from http://blog.spikesource.com/mysql_hotbackup.htm:
I restore a database from an SQL dump like this:

(...)
f= open('test.sql', 'r')
sql = f.read()
f.close()
self.query("""%s""" % sql)
(...)

This works fine for dumps made with "mysqldump -uroot -B test > test.sql".
However, if performing a commit afterwards in the above code, I get
a "command out of sync; you can't run this command now" I even get this when
trying out the SET FOREIGN_KEY_CHECK properties as suggested in the URL.

How do I properly "clearn up" after processing the raw SQL file in the query
above?

Thanks,
Frank
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top