gpt4 book ai didi

c# - 使用方法 mysql_native_password 身份验证失败

转载 作者:IT老高 更新时间:2023-10-29 00:01:21 25 4
gpt4 key购买 nike

尝试使用 Visual Studio 2012 Update 3 中的 Connector/Net C#/WinForms 连接到我的 Web 主机上的 MySQL,但收到以下错误消息:

Authentication to host '1.1.1.1' for user 'username@mydomain.com' using method 'mysql_native_password' failed with message: Access denied for user 'username@mydomain.com'@'2.2.2.2' (using password: YES)

string connectionString = "SERVER=1.1.1.1;PORT=3306;DATABASE=databaseName;UID=username@mydomain.com;PASSWORD=mypassword;";

MySqlConnection connection = new MySqlConnection(connectionString);
connection.Open();

我正在远程连接,已将我的 IP 列入白名单(甚至将所有 (%) 临时列入白名单以进行测试),三次检查用户名和密码以及 IP。

我最初尝试使用不带域的用户名(用户名而不是 username@mydomain.com),但它给了我以下错误:

Authentication with old password no longer supported, use 4.1 style passwords.

任何帮助将不胜感激,谢谢!

最佳答案

它的“远程数据库访问主机”问题。“您可以通过将外部 Web 服务器的域名添加到能够访问您网站上的数据库的主机列表来允许外部 Web 服务器访问您的 MySQL 数据库。”

MySql 访问权限未授予运行应用程序的系统的 IP 地址。(在您的情况下为“2.2.2.2”)。

注意:-“2.2.2.2”是您的公共(public) IP 地址。

关于c# - 使用方法 mysql_native_password 身份验证失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17647816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com