Bug #34302 mysqldump couldn't dump database named with "-"
Submitted: 5 Feb 2008 10:36 Modified: 5 Feb 2008 11:18
Reporter: Anton Bikoff Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Backup Severity:S2 (Serious)
Version:5.1.22-rc OS:FreeBSD (6.2RELEASE)
Assigned to: CPU Architecture:Any
Tags: mysqldump dump database error

[5 Feb 2008 10:36] Anton Bikoff
Description:
If database named with sign minus (-), e.g. "test-qw", "test-test", "domain-com" etc.; AND database has tables - mysqldump couldn't dump such database.

How to repeat:
mysql> create database `test-test`;
Query OK, 1 row affected (0.00 sec)

mysql> use test-test;
Database changed

mysqldump -uroot -ppassword test-test >test.sql
OK

Next level:
mysql> use test-test;
Database changed

mysql> CREATE TABLE `test-test`.`qwerty` (
`1` VARCHAR( 255 ) NOT NULL ,
`2` VARCHAR( 255 ) NOT NULL 
) ENGINE = MYISAM ;

mysqldump -uroot -ppassword test-test >test.sql
mysqldump: Couldn't execute 'use test-test': 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 '-test' at line 1 (1064)

mysql> use test-test;
Database changed

BUG

But phpmyAdmin dumps such databases very successfully.
[5 Feb 2008 11:18] Sveta Smirnova
Thank you for the report.

I can not repeat described behavior with current development sources, although bug is repeatable with version 5.1.22. Please wait next release.
[3 Jun 2008 9:08] Philip Owen
I am seeing this bug with 5.1.22-rc on Windows. Will try upgrading to 5.1.24 (latest current version).