使用 C# 代码的用户拒绝远程 MySql 访问,但可以使用 DbVisualizer 连接
我可以在 C#/.Net winform 应用程序中连接到本地 MySql 服务器,但是当我尝试连接到远程 MySql 服务器时。我收到“用户 @'%' 访问数据库被拒绝”错误消息。但是,如果远程服务器拒绝连接。为什么我可以用DbVisualizer连接到远程MySql数据库?我很确定问题不在于代码,而在于服务器设置。
I can connect to local MySql server in my C#/.Net winform app but when I try to connect to a remote MySql server. I got a "Access denied for user @'%' to database" error message. However, if the remote server is denying the connection. How come I can connect to the remote MySql database with DbVisualizer? I'm pretty sure the problem is not with code but rather the server settings.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在使用 Java 时也遇到了同样的问题。我的问题的解决方案是不指定目录。不知道C#是不是这样,你试试吧。
I had the same problem with Java. Solution to my problem was not specifying the catalog. I'm not sure if this is the case with C#, give it a try.
将此代码与您的进行比较。
compare this code with yours.