PDA

View Full Version : database name with hyphen cause problem?


MaryC
08-05-2005, 05:11 PM
I'm trying to create a MySQL user account by granting privilege. here is my sql code

grant select on xdomainname-database_name.table_name to a_user@'%' identified by 'password'.

I got error code 1064, message said I have syntax error near '-database_name'.

Did I do anything wrong?

Kevin
08-05-2005, 05:14 PM
You can't add users to your database or use the GRANT SQL command. You can only access the databases using the account information on the primary account whice was listed in the MySQL activation letter you recieved when you activated your MySQL access.

MaryC
08-05-2005, 05:20 PM
Wouldn't this be dangous? I use the primary account to create the necessary tables within the database, then I would like to create user accounts with limited privilege to certain tables. What should I do then?

Kevin
08-05-2005, 05:56 PM
The problem with GRANT is that if you can GRANT access to other users you could grant greater access for yourself which could allow you to break the security of the other users on the system. The only public access to your database would be through whatever scripts you put on the web site so that is where your security would be controlled. There shouldn't be any need for additional custom MySQL access permissions.

If you really do need custom MySQL access permissions you would need to go to a dedicated MySQL server where you are the only account on the box and you have complete control over the MySQL engine.

MaryC
08-05-2005, 06:21 PM
Thank you for the explanation.