Authentication to host '' for user '' using method 'mysql_native_password' failed with message

Authentication to host '' for user '' using method 'mysql_native_password' failed with message_第1张图片


每次走到ITOO.Library.Core.Common.MySqlHelper.ExecuteDataTableNonConn(sql);的时候就会报错:

Authentication tohost '' for user '' using method 'mysql_native_password' failed with message:Access denied for user ''@'xxx' (using password: NO)


 //连接数据库
  string connstr = ITOO.Library.Core.Common.MySqlHelper.connectionString;
  MySqlConnection conn = ITOO.Library.Core.Common.MySqlHelper.GetConnection;


connstr和conn读取到的值为空

 

配置文件中连接数据库代码:


 

我着实的检查了每个配置文件的数据库连接地址,数据库名和密码都是没有错的

 

错误原因:

底层代码被改

这是底层代码:

 public static string connectionString = System.Configuration.ConfigurationManager.AppSettings["strDBKey"];

底层接收的值是strDBKey而不是connectionString


解决方法:

将配置文件中连接数据库的字段改为:key="strDBKey"











你可能感兴趣的:(-----【云平台】,✈项目)