Authentication failed using method mysql_native_password

Badger Sharescott picture Badger Sharescott · Jul 15, 2013 · Viewed 89.8k times · Source

Trying to connect to MySQL on my web host, using Connector/Net C#/WinForms in Visual Studio 2012 Update 3, but getting the below error message:

Authentication to host '1.1.1.1' for user '[email protected]' using method 'mysql_native_password' failed with message: Access denied for user '[email protected]'@'2.2.2.2' (using password: YES)

string connectionString = "SERVER=1.1.1.1;PORT=3306;DATABASE=databaseName;[email protected];PASSWORD=mypassword;";

MySqlConnection connection = new MySqlConnection(connectionString);
connection.Open();

I am connecting remotely, have whitelisted my IP (and even temporary whitelisted all (%) to test), triple checked the username and password and IP.

I originally tried the username without the domain ( username rather than [email protected]) but it gave me the below error:

Authentication with old password no longer supported, use 4.1 style passwords.

Any assistance would be much appreciated, thanks!

Answer

yadavr picture yadavr · Oct 10, 2013

Its problem of 'Remote Database Access Hosts'. "You can allow external web servers to access your MySQL databases by adding their domain name to the list of hosts that are able to access databases on your web site."

MySql access is not granted to IP address of the system at which application is running.(in your case its '2.2.2.2' ).

Note:- '2.2.2.2' is your public IP address.