質問

I have four websites, each of which were being accessed with a singular username/password which had privileges on all of the databases.

However, for security reasons, I've finally set up a new user for each site, with each user only having access to the necessary database. Here is the code that I used to create the user and grant privileges for one particular database -

CREATE USER 'wedding1'@'localhost' IDENTIFIED BY 'somepass';
GRANT ALL PRIVILEGES ON wedding1.localhost TO 'wedding1'@'localhost';

However, when I log in to PHPMyAdmin using the credentials for the user I just created, the database is shown as expected but none of the tables are listed.

No entries are placed in my logs and I have tried to FLUSH PRIVILEGES;

Am I missing something from the above lines that could be causing this behaviour? Thanks.

役に立ちましたか?

解決

You only granted privileges on a table called localhost within wedding1 DB. I am guessing this is not what you want. Change your grant statement as follows:

GRANT ALL PRIVILEGES ON wedding1.* TO 'wedding1'@'localhost';
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top