MySQL authentication error with .NET connector 8.0

0

When I use the .NET connector with my console application ( .NET 4.7.2) to connect to a remote MySQL server I get the error below.

MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication to host 'XX.XXX.XXX.XX' for user 'YYYYYYY' using method 'mysql_native_password' failed with message: Access denied for user 'YYYYYYY'@'ZZZ.ZZZ.ZZZ.ZZZ' (using password: YES) ---> MySql.Data.MySqlClient.MySqlException (0x80004005): Access denied for user 'YYYYYYY'@'ZZZ.ZZZ.ZZZ.ZZZ' (using password: YES)

I thought it has to do with the password and reset it and it still didn't work, have been able to connect to it successfully using "HeidiSQL" and "MYSQL Workbench" and so there doesn't seem to be any problem with password perse at the server end.

Please note that I am using MySQL with SSL connection as demonstrated by sample code below.

var builder = new MySqlConnectionStringBuilder();

builder.Server = "XX.XXX.XXX.XX";
builder.UserID = "YYYYYYY";
builder.Password = "PPPPPPPPPPP";
builder.SslCa = @"D:\certs\server-ca.pem";
builder.SslKey = @"D:\certs\client-key.pem";
builder.SslCert = @"D:\certs\client-cert.pem";
builder.SslMode = MySqlSslMode.VerifyFull;
builder.Database = "noodlewatch";
builder.Port = 3306;
builder.Pooling = true;
builder.UseCompression = true;

MySqlConnection conn = new MySqlConnection(builder.ConnectionString);

Any ideas on what needs to be done here?

I have tried a lot of permutations and combinations with the "MySqlConnectionStringBuilder" but it always ends the same way. It definitely is not a "password" issue as I can connect to it with standard MySQL clients.

Edit:

This is not a duplicate of that other question with a similar error because that one had to do with user grants, I am able to connect to the same remote server with "HeidiSQL" and "MySQL Workbench" from the same client machine so it's quite obviously not something to do with privilege issues for the user.

Edit:

The . NET application and the other client applications are residing on the same Windows 10 machine.

c#
mysql-connector
asked on Stack Overflow Nov 14, 2019 by Krishnan Venkiteswaran • edited Nov 14, 2019 by Uwe Keim

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0