Failed To Connect MySQL via C#
-
am working on a micro-finance accounting system, and i have decided to use MySQL as the database. I have installed MySql 4.01, and have everything including the Server, Admin, and connector installed and running fine. Am currently trying to test a means of loading data into a datagridview from one of the tables in the MySql db. But app fails when i try to open a connection to the db: MySqlConnection con = new MySqlConnection("server=localhost;database=pets;uid=root;password=alchemy@6"); con.Open(); //creates error "Access denied for user 'root'@'localhost' (using password: YES)" can someone help me?
-
am working on a micro-finance accounting system, and i have decided to use MySQL as the database. I have installed MySql 4.01, and have everything including the Server, Admin, and connector installed and running fine. Am currently trying to test a means of loading data into a datagridview from one of the tables in the MySql db. But app fails when i try to open a connection to the db: MySqlConnection con = new MySqlConnection("server=localhost;database=pets;uid=root;password=alchemy@6"); con.Open(); //creates error "Access denied for user 'root'@'localhost' (using password: YES)" can someone help me?
-
looks like your username and/or password is wrong do you not think?
Life goes very fast. Tomorrow, today is already yesterday.
I don't think, because i have just used those very parameters to log into the database via the MySql Adminstrator (GUI), and can clearly see the database. could it be a result of having a session running with those very details in the Adminstrator? :confused:
-
I don't think, because i have just used those very parameters to log into the database via the MySql Adminstrator (GUI), and can clearly see the database. could it be a result of having a session running with those very details in the Adminstrator? :confused:
I am not so familiar with MySQL but if there is a setting that specifies the number of logins available (like in SQL Server) then I would say that could be a cause yes. One thing to note about database connection is that the error message you get is not always correct
Life goes very fast. Tomorrow, today is already yesterday.
-
I am not so familiar with MySQL but if there is a setting that specifies the number of logins available (like in SQL Server) then I would say that could be a cause yes. One thing to note about database connection is that the error message you get is not always correct
Life goes very fast. Tomorrow, today is already yesterday.
Well, after rummaging through the MySQL .NET API Documentation and failing to find a clue, i decided to change the connection string to a different one like this: my Original : "server=localhost;database=db;uid=root;password=abcdaaa" in the API : "Database=db;DataSource=localhost;UserId=root;Password=abcdaaa;"; New Hack: "Database=db;DataSource=localhost;UserId=root;Password=abcdaaa;Port=3308"; /*This worked bcoz i realised i had configured MySql to listen on port 3308, tried changing it back to 3306 (default) with no success, until i decided to add the 'Port=3308' to the MySQL connection string.*/ :laugh: