mysqldump gives error 1064
Tagged:  •  

I tried to backup a database with the mysqldump command, but got the following error:

mysqldump: Couldn't execute 'use example.com': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.com' at line 1 (1064)

It seems the database name is not properly escaped and the . is misinterpreted.

This is a bug in MySQL which has been fixed in 5.1.23. So you should either update your MySQL installation, patch your sources (see bug report), or rename your database.