learner learner - 15 days ago 5
MySQL Question

myqsldump thowing an error code (1054)

Can you please advise me what I am doing wrong here? My sqldump command is not working correctly as it ?

mysqldump -u jim -p mydb mytable --where mycondition="ERROR-5000-JAVA" > /home/jim/issue1.sql
Enter password:
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `mytable` WHERE mycondition=ERROR-5000': Unknown column 'ERROR' in 'where clause' (1054)

Answer

You need quotes around the whole --where option, so that the double quotes around the value will be sent to MySQL.

mysqldump -u jim -p mydb mytable --where 'mycondition="ERROR-5000-JAVA"' > /home/jim/issue1.sql