用户无法在 mysql 工作台中看到数据库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19392133/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
User cannot see databases in mysql workbench
提问by elithin
I'm trying to learn Spring Roo using this tutorial. So, what I did was:
我正在尝试使用本教程学习 Spring Roo 。所以,我所做的是:
- 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 %
- 转到 mysql 工作台
- 创建一个名为“pizzashop”的新模式
- 通过服务器管理帐户访问 localhost
- 在 'users and privileges' 中创建一个名为 'pizzashop' 和密码为 'pizzashop' 的新用户,并限制与匹配 % 的主机的连接
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.
希望你能在这里帮助我。不知道是Workbench的问题还是mysql的问题。
Edit> Added to the User Accounts one more entry with the same characteristics as the other but with 'localhost' instead of %
编辑> 向用户帐户添加了一个与另一个具有相同特征的条目,但使用 'localhost' 而不是 %
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)
添加到模式权限的条目说主机:本地主机模式:pizzashop 和所有对象和 ddl 权限(这是我唯一为比萨店用户拥有的权限)
Still, when I connect to localhost using the user pizzashop no schemas appear
尽管如此,当我使用用户比萨店连接到 localhost 时,没有出现任何模式
采纳答案by Mike Lischke
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 %).
在这种情况下,使用 localhost 作为要连接的机器的附加用户根本没有帮助。这只是连接到服务器所需的东西(并且您的连接已经通过使用 % 对“pizzashop”有效)。
Not sure what's going wrong in your case but I just tested (against a 5.6 server) in MySQL Workbench 6.0.7:
不确定您的情况出了什么问题,但我刚刚在 MySQL Workbench 6.0.7 中测试了(针对 5.6 服务器):
- 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).
- 创建一个新用户“测试”。无密码,无权限,标准认证。
- 创建到同一台服务器的新连接(实际上我复制了现有的连接,清除了密码并更改了用户名)。
- 打开这个新连接(另一个连接可以保持打开状态)。
- 除非您启用了系统表,否则不会向“test”用户显示任何模式,在这种情况下,用户至少会看到“performance_schema”。
- 返回管理连接并为单个模式添加模式权限(比如“测试”)。
- 关闭测试连接并重新打开它。现在除了 'performance_schema' 测试用户还应该看到模式测试。
- 返回管理连接并为“test”添加“SHOW DATABASES”全局权限。
- 关闭测试连接并重新打开它。“test”用户现在应该看到服务器中的所有模式,但在模式树展开时看不到其中的对象(除了我们在第 5 点中为该用户启用的“test”模式)。
If that works for you it should be easy to apply this also to your own user.
如果这对您有用,那么将其也应用于您自己的用户应该很容易。
回答by exussum
Its a MySQL problem and faily common, % does not match localhost. Add an entry for user@localhost with the same permissions
它是一个 MySQL 问题并且失败很常见,% 与 localhost 不匹配。为 user@localhost 添加一个具有相同权限的条目
回答by generic_toaster
Sounds like a mysql problem, you don't list a lot of info, but did you issue a grant command for that user?
听起来像是 mysql 问题,您没有列出很多信息,但是您是否为该用户发出了授权命令?
https://dev.mysql.com/doc/refman/5.1/en/grant.html
https://dev.mysql.com/doc/refman/5.1/en/grant.html
The grant command can be tricky too, see:
grant 命令也可能很棘手,请参阅:
MySQL: Grant **all** privileges on database
for more info.
了解更多信息。
回答by Ignacio Carballal
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.
经过一天调查此问题后,我发现我必须创建 2 个具有相同名称但具有不同“来自主机”选项的用户。
Please see how MySQL Workbench Users and privileges should looks like. enter image description here
请查看 MySQL Workbench 用户和权限的外观。 在此处输入图片说明
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
我希望这有助于问候
回答by Xiaohui Zhao
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.
这主要是由于权限问题而发生的。就我而言,由于某种原因,MySQL 文件夹是隐藏/只读的,因此尽管 SQL 查询成功,但 MySQL Workbench 无法访问架构面板上的相关数据库。我通过取消隐藏 MySQL 文件夹解决了这个问题,然后所有数据库都成功显示在架构面板上。Show databases 命令也可以显示数据库。