问题
I'm trying to learn Spring Roo using this tutorial. So, what I did was:
- go to mysql workbench
- create a new schema called 'pizzashop'
- access localhost through the server administration account
- create a new user in 'users and privileges' with name 'pizzashop' and password 'pizzashop', and limit connectivity to hosts matching %
when I tried to connect to the server using this account I noticed that it couldn't see any database
I tried creating an entry in 'schema privileges' explicity allowing the 'pizzashop' user to see the 'pizzashop' schema, but it didn't work
Hope you can help me here. I don't know if it's a Workbench problem or a mysql problem.
Edit> Added to the User Accounts one more entry with the same characteristics as the other but with 'localhost' instead of %
Added to the schema privileges an entry saying host:localhost schema:pizzashop and all object and ddl rights (this is the only one I have for the pizzashop user)
Still, when I connect to localhost using the user pizzashop no schemas appear
回答1:
The additional user with localhost as machine to connect from does not help at all in this case. It's just something needed for connecting to the server (and your connection works for 'pizzashop' already by using %).
Not sure what's going wrong in your case but I just tested (against a 5.6 server) in MySQL Workbench 6.0.7:
- Create a new user 'test'. No password, no rights, standard authentication.
- Created a new connection to the same server (actually I duplicated the existing one, cleared the password and changed the user name).
- Open this new connection (the other connection can stay open).
- No schemas are shown to the 'test' user unless you have enabled system tables in which case the user sees at least 'performance_schema'.
- Go back to the admin connection and add schema privs for a single schema (say 'test').
- Close the test connection and reopen it. Now in addition to 'performance_schema' the test user should also see the schema test.
- Go back to the admin connection and add 'SHOW DATABASES' global priv for 'test'.
- Close test connecton and reopen it. The 'test' user now should see all schemas in the server but no objects in them when the schema tree is expanded (except for the 'test' schema we enabled for that user in point 5).
If that works for you it should be easy to apply this also to your own user.
回答2:
Its a MySQL problem and faily common, % does not match localhost. Add an entry for user@localhost with the same permissions
http://bugs.mysql.com/bug.php?id=69570
回答3:
Sounds like a mysql problem, you don't list a lot of info, but did you issue a grant command for that user?
https://dev.mysql.com/doc/refman/5.1/en/grant.html
The grant command can be tricky too, see:
MySQL: Grant **all** privileges on database
for more info.
回答4:
After one day of investigating this issue, I found that I had to create 2 users with the same name but with different "From Host" option.
Please see how MySQL Workbench Users and privileges should looks like. enter image description here
Please do not forget to assign Schema Privileges to the schema you want and "Show Databases" option in Administrative Roles tab. This must be set in both users.
I hope this helps Regards
回答5:
This is mainly happened due to permission issue. For my case, due to some reason, MySQL folder are hide/read only, so MySQL Workbench cannot access relevant databases on the schema panel, although SQL query is successful. I resolve the issue by un-hide the MySQL folder, then all databases are shown on the schema panel successfully. Show databases command can display databases also.
来源:https://stackoverflow.com/questions/19392133/user-cannot-see-databases-in-mysql-workbench