C# 远程 MySQL - 拒绝用户访问 [英] C# Remote MySQL - Access Denied For User

查看:41
本文介绍了C# 远程 MySQL - 拒绝用户访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎无法使用 C# 连接到我的远程 MySQL 数据库.当我使用 MySQL Workbench 时,我能够成功连接.但是当我通过连接字符串与 C# 连接时,我得到:

I cannot seem to connect to my remote MySQL database using C#. When I use MySQL Workbench I am able to connect successfully. But when I connect via connection string with C# I get:

用户 'username'@'myipaddress' 对数据库 'drawingnumbers' 的访问被拒绝

我的连接字符串:

  connectionString = "server=" + server + ";user=" + uid + ";database=" + database + ";port=" + port + ";password=" + password + ";";

我尝试过的:

  1. 在 cpanel 上的远程 MySQL 连接中添加了我的本地和外部 IP
  2. 授予我的用户名使用我在网上找到的一些 SQL 命令远程连接的权限,访问被拒绝(这是一个共享服务器)
  3. 使用 MySQL 工作台成功连接,参数完全相同

推荐答案

你是否在 CPanel 中使用了用户名后缀,因为大多数情况下人们会错过...例如,如果您的 CPanel 用户名是 abc 那么它应该是abc_TheUsernameForMySQL

are you using the username suffix in CPanel, because people miss that in most cases... for example if your CPanel username was abc then it should be abc_TheUsernameForMySQL

如果没有,请尝试您的 CPanel 用户名和密码,您也可以使用错误中的 ip 地址来确认您添加了正确的远程 ip 地址以访问 mysql 服务器

if not, try your CPanel username and Password, also you can use the ip address from the error to confirm you added the correct remote ip address to access the mysql server

这篇关于C# 远程 MySQL - 拒绝用户访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆