-1

A user I'm supporting is getting an error. The user has grants to various tables in mydb, but when they try to access them, they get the error:

Access denied for user 'myuser'@'myhost' to database 'mydb'

What grant command is needed to let myuser@'myhost access mydb?

1 Answer 1

1

you firstly could check if the user truly has the privilege to access the DB or not by using the next command:

SHOW GRANTS FOR 'username'@'host';

if not, use this command

GRANT USAGE ON database.* TO 'username'@'host';
FLUSH PRIVILEGES;

if he has the privilege , the password might be wrong , try to change it and don't forget to add FLUSH PRIVILEGES; to make sure the command is applied now (it's implied used after revoke and grant )

ALTER USER 'username'@'host' IDENTIFIED BY 'newpassword';
FLUSH PRIVILEGES;

I guess the reason of your problem is that: you might have written the command like that

GRANT ALL ON company.* TO 'user_name'@'localhost'

so he can't access via another computer .

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.