Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Unfortunately, I have a database name with a dash in it. How do I grant access to that database as mysql reports a syntax error.

e.g.

grant select,insert,update,delete on astpp.* to 'portal'@'localhost' identified by 'Ab7g12Xh35' with grant option;

works, but

grant select,insert,update,delete on astpp-eth01.* to 'portal'@'localhost' identified by 'Ab7g12Xh35' with grant option;

Does not.

Neither does: grant select,insert,update,delete on 'astpp-eth01'.* to 'portal'@'localhost' identified by 'Ab7g12Xh35' with grant option;

share|improve this question
add comment

1 Answer 1

On mysql you escape database column names with the backtick character unless you have ANSI_QUOTES enabled. See http://dev.mysql.com/doc/refman/5.0/en/identifiers.html.

Try using a command like this.

grant select,insert,update,delete on `astpp-eth01`.* to 'portal'@'localhost' identified by 'Ab7g12Xh35' with grant option;
share|improve this answer
    
Brilliant! that worked a treat. Thanks man! –  Matt May 7 '10 at 1:39
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.