MySQL Forums
Forum List  »  Connector/Python

MySQL restore from mysql shell
Posted by: Reodor Felgen
Date: April 07, 2008 06:52PM

Hello,

I know about mysqldump and mysql for backing up and restoring MySQL databases from a terminal, but what if I have the SQL backup in a string variable and access to a mysql cursor through python and want to restore the database?

I've successfully parsed the SQL string in a query statement, but I'm uncertain if it is working as it should. For example I tried prior to the query to set autocommit off, perform the query and do a commit, but I always get a "Command out of sync" exception. Pretty much every query afterwards will result in this error.

The only way I've gotten this to work, is to do the query and then disconnect and reconnect to the MySQL server.

So the question is: If I have the SQL backup in a string variable and access to the cursor through python, how do I correctly perform a db restore?

Options: ReplyQuote


Subject
Written By
Posted
MySQL restore from mysql shell
April 07, 2008 06:52PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.