1

I run the following simple python 2.7 code;

   dumpcmd = "mysqldump -u " + DB_USER + " -p" + DB_USER_PASSWORD + " " + db + " > " + TODAYBACKUPPATH + "/" + db + ".sql"
   os.system(dumpcmd)

The error I got is as follows;

mysqldump: Couldn't execute 'SET OPTION SQL_QUOTE_SHOW_CREATE=1': You have an er
ror in your SQL syntax; check the manual that corresponds to your MySQL server v
ersion for the right syntax to use near 'OPTION SQL_QUOTE_SHOW_CREATE=1' at line
 1 (1064)

The strange thing is that my python code does not contain anything like SET OPTION SQL_QUOTE_SHOW_CREATE=1 as mentioned in the error. Can someone advise?

4
  • What version of MySQL are you using? Commented Oct 13, 2014 at 10:14
  • Can you please show where all those constants are defined? Commented Oct 13, 2014 at 10:14
  • @ javidcf: I am using MySQL 5.6.16 Commented Oct 13, 2014 at 10:16
  • I got the python code here tecadmin.net/python-script-for-mysql-database-backup Commented Oct 13, 2014 at 10:18

3 Answers 3

1

That seems to happen because you are using mysqldump 5.5 or prior with a MySQL 5.6 database. The SET OPTION syntax was removed (see discussion in this bug report), causing this tool to stop working.

You will need to update your version of mysqldump. More info about it in this other bug report.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks. But the strange thing is that in my python code, there is no code like SQL_QUOTE_SHOW_CREATE=1
@user3293156 Sorry, you are right, I misread the code. I have updated the answer.
0

You might need a space between -p and DB_USER_PASSWORD.

dumpcmd = "mysqldump -u " + DB_USER + " -p " + DB_USER_PASSWORD + " " + db + " > " + TODAYBACKUPPATH + "/" + db + ".sql"

2 Comments

Thanks for the answer. Unfortunately, it did not solve the problem.
Perhaps try using from subprocess import call call(["mysqldump", "-u", DB_USER, "-p", DB_USER_PASSWORD, ...]) ?
0

Thanks to the answer from javidcf, I found the answer to my question. The solution is to use a command-line mysqldump version that supports MySQL 5.6.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.