Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Failed To Connect MySQL via C#

Failed To Connect MySQL via C#

Scheduled Pinned Locked Moved C#
databasehelpcsharpmysqlsysadmin
5 Posts 2 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nemesis Fixx
    wrote on last edited by
    #1

    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?

    M 1 Reply Last reply
    0
    • N Nemesis Fixx

      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?

      M Offline
      M Offline
      musefan
      wrote on last edited by
      #2

      looks like your username and/or password is wrong do you not think?

      Life goes very fast. Tomorrow, today is already yesterday.

      N 1 Reply Last reply
      0
      • M musefan

        looks like your username and/or password is wrong do you not think?

        Life goes very fast. Tomorrow, today is already yesterday.

        N Offline
        N Offline
        Nemesis Fixx
        wrote on last edited by
        #3

        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:

        M 1 Reply Last reply
        0
        • N Nemesis Fixx

          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:

          M Offline
          M Offline
          musefan
          wrote on last edited by
          #4

          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.

          N 1 Reply Last reply
          0
          • M musefan

            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.

            N Offline
            N Offline
            Nemesis Fixx
            wrote on last edited by
            #5

            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:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups