0

the title says it all, here was my code

GRANT SELECT, INSERT, UPDATE, DELETE ON 'database_name' TO 'mysqluser'@'111.111.111.111';

it says

ERROR 1064 (42000) : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax near ''database_name' TO 'mysqluser'@'111.111.111.111'' at line 1
2
  • Umm.. take the quotes off of database_name? Commented Jun 12, 2014 at 15:00
  • error : no database selected Commented Jun 12, 2014 at 15:01

2 Answers 2

2

This:

GRANT SELECT, INSERT, UPDATE, DELETE ON 'database_name' TO 'mysqluser'@'111.111.111.111';

Should be:

GRANT ALL ON 'database_name'.* TO 'mysqluser'@'111.111.111.111';

In your specific case(tested on my mysql server):

GRANT SELECT, INSERT, UPDATE, DELETE ON database_name.* TO 'mysqluser'@'111.111.111.111';
Sign up to request clarification or add additional context in comments.

1 Comment

but i only need those four only.
1

You quoted the DB name with ', which turns it into a string. Once it's a string, it's no longer a table name. it's just a string that CONTAINS something that looks like a table name.

It should be EITHER

GRANT ... ON database_name
or
GRANT ... ON `database_name`

The backticks are only necessary if the db name happens to be a reserved word.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.