In this article I will explain with an example, how to resolve the following error:
Access denied for user 'roots'@'localhost' (using password: YES) while working with
MySQL database.
Error
This error occurs due to the following reason in
MySQL database.
1. User Id or Password specified in connection string is not correct.
In the below connection string, the User Id and Password are incorrect.
<connectionStrings>
<add name="constr" connectionString="Data Source=localhost;port=3306;Initial Catalog=Northwind;User Id=roots;password=pass@1234" />
</connectionStrings>
Solution
Following is the solution for the above error.
1. Make sure that the User Id and Password are correct in the connection string as shown below.
<connectionStrings>
<add name="constr" connectionString="Data Source=localhost;port=3306;Initial Catalog=Northwind;User Id=root;password=pass@123" />
</connectionStrings>