-1

A user I'm supporting is getting the error. The user has grants to various tables in mydb, but when he tries to access them, he gets the error:

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

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

Thanks
Ben

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 .

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.