我想将 MySQL 5.5 与 Visual Studio 2017 应用程序连接起来,因为它不支持较新的 MySQL 8.0,只有 5.5 ......它会抛出这个内部 MySQL 异常:
mysql_native_password
使用拒绝用户 root@localhost 的方法访问来验证用户 riit 的主机“localhost” (使用密码:是)
我授予root权限,我想如果我将加密设置为旧密码,它就会被修复。
<connectionStrings>
<add name="xyconnectionstring" Server=localhost;port=3306;Database=cafeteriadb;user=root;password=password;"providerName="MySql.Data.MySqlClient">
</connectionStrings>
代码:
public ArrayList RetreiveAllCategoriesFromDatabase()
{
ArrayList CategoriesList = new ArrayList();
using (MySqlConnection connection = new MySqlConnection(ConnectionString))
{
MySqlCommand command = new MySqlCommand("SELECT ID, CategoryName, CategoryPicture FROM Categories;", connection);
connection.Open();
}
}