Unable to prepare statement with underscore

Patrik Jansson <[email protected]>
Newsgroups gmane.comp.db.mysql.perl
Message-ID <[email protected]>
Hi,

I'm trying to run the following statement:
GRANT ALL PRIVILEGES ON user\_abcd.* TO 'user_abcd'@'192.168.2.1' 
IDENTIFIED BY 'password'

This is the code:

my $query = "GRANT ALL PRIVILEGES ON user\\_abcd.* TO 
'user_abcd'\@'192.168.2.1' IDENTIFIED BY 'password'";

print $query;
$dbh->do($query);

But I get the error: DO: Something wrong while try to prepare query 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 '\_abcd.* TO 
'user_abcd'@'192.168.2.1' IDENTIFIED BY 'password'' at line 1

If I run the exact same command directly with the mysql client I get no 
error at all.

What am I doing wrong or doesn't the DBD handle underscores in database 
names?

Thanks,
-Patrik



-- 
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe:    http://lists.mysql.com/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.