gpt4 book ai didi

c# - 使用方法 'localhost' 对用户 'root' 的主机 'mysql_native_password' 的身份验证失败并显示消息(使用密码 : NO)

转载 作者:行者123 更新时间:2023-11-29 02:48:02 25 4
gpt4 key购买 nike

你们能帮我完成论文吗,这是我系统中的一个问题。

MySqlConnection cn2 = new MySqlConnection(cn.ConnectionString);
cn2.Open();-->>> Authentication to host 'localhost' for user 'root' using method 'mysql_native_password' failed with message: Access denied for user 'root'@'localhost' (using password: NO)

listView1.Items.Clear();
string sql = "Select * from tblrecord where DateTime between '" + dateTimePicker1.Value + "' and '" + dateTimePicker2.Value + "'";
cm = new MySqlCommand(sql);
//cm = new MySqlCommand(sql, cn1);
dr = cm.ExecuteReader();
dr.Read();
if (dr.HasRows)

最佳答案

只需在您的连接字符串中添加密码,因为您还没有在您的连接中添加它。

关于c# - 使用方法 'localhost' 对用户 'root' 的主机 'mysql_native_password' 的身份验证失败并显示消息(使用密码 : NO),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39442151/

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