i'm on the command line and i'm trying to grant privileges to a user. normally i can do this with no issues but this is a different case that i was not aware of
i have a database with this format: databasename-suffix.
the dash it throwing it off. here are the queries that i run and the errors i get:
GRANT select
ON database-name
TO me;
[[b]error[/b]]
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 '-dev
TO me' at line 2
GRANT select
ON 'database-name'
TO me;
[[b]error[/b]]
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 ''database-name' TO me' at line 2
GRANT select
ON database-name.*
TO me;
[[b]error[/b]]
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 '-dev.*
TO me' at line 2
i can't figure out a way around this. can i receive some help on this? thank you
that's right. backtick. i just couldn't remember it for the life of me lol. i used them when i wrote macros sometimes.
i would change the table manually but it's just not the best option. i have access to the dev but i may not have access to stage and production. so to know it by the command line is best. i can give the command to the systems people when the time is needed.
For 'quoting' stuff in MySQL we use:
` (backtick) for identifiers - databases, columns, etc.
' (quote) for values
I think the SQL standard also requires double quotes, but it's good to pick one and use it consistently. I use single quotes, because I put my SQL statements in double quotes.