首页 > 解决方案 > MySqlConnection ignores incorrect password when SQL username matches Windows account

问题描述

I have MySql Server with authentication_windows.dll plugin. There I have windows account "test_win" and sql user "test_sql" with password "test".

Even if Integrated Security is set to false, as long as user id matches existing windows account, the connection is opened without any error.

I am trying on MySQL80 Enterprise with authentication_windows.dll plugin.

Example of my connection string:

server=localhost;user id=test_win;database=mydb;Integrated Security=False;password=incorrect

using (var connection = new MySqlConnection(connectionString))
{
    connection.Open();
}

Actual result: connection is opened and validated I would expect "Access denied for @test_win (using password: YES)"

How can I force account validation except for Integrated security = false ?

Additional information:

Tested same scenario on MsSql with expected result

Data Source=localhost;Initial Catalog=mydb;User ID=test_win;Password=incorrect

Exception: Login failed for user 'test_win'

using (var connection = new SqlConnection(connectionString)
{
    connection.Open();
}

标签: c#mysqlwindows-authenticationmysqlconnection

解决方案


推荐阅读