简体   繁体   English

“拒绝用户'test'@'%'访问数据库'test'

[英]"Access denied for user 'test'@'%' to database 'test'

I have been trying to access the remote MySql database server in C# Entity framework but end in following error 我一直试图在C# Entity framework访问远程MySql数据库服务器,但以以下错误结束

{"Access denied for user 'test'@'%' to database 'test'"}

My connection string is server='192.168.0.1';uid=test;database=test;password=1234 我的连接字符串是server='192.168.0.1';uid=test;database=test;password=1234

However if i access the database through workbench it allows me to access the server and inserting and deleting the data in tables. 但是,如果我通过workbench访问数据库,它将允许我访问server以及在表中inserting and deleting数据。

What causing the error ? 是什么导致错误?

Execute below statement to grant access on test- 执行以下语句以授予对测试的访问权限-

GRANT all privileges on test.* to test@'%' identified by '1234';

Note: You can change all privileges with your specific permissions. 注意:您可以使用特定权限更改所有权限。

You can also assign rights on all databases by- 您还可以通过以下方式在所有数据库上分配权限:

GRANT all privileges on *.* to test@'%' identified by '1234';

Note: Best way is that rights should provide only to specific ip and limited rights as per requirement. 注意:最好的方法是,权限应仅按要求提供给特定的ip和受限权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM