How to fix: Unable to connect to any of the specified MySQL hosts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gomzi
    Contributor
    • Mar 2007
    • 304

    How to fix: Unable to connect to any of the specified MySQL hosts

    Could anyone tell me as to what this error means?

    "Unable to connect to any of the specified MySQL hosts"

    I am trying to connect to a remote mysql database using asp.net.
  • mijaved
    New Member
    • Feb 2008
    • 1

    #2
    The Problem occurs when you use a different port number other than the default port number "3306" while configuring the MySQL Database Server. and Don't mention the port number in the Connection String.
    Try the following connection string: (replace 3306 with your specified port number for MySQL)
    "Server=localho sr:3306;Databas e=Mydb;User ID=root;Passwor d=xxxx;CharSet= utf8"

    If you don't want to change in your code then, re-configure the MySQL database server with default port number "3306".

    Comment

    • finked1973
      New Member
      • Jun 2009
      • 20

      #3
      Remote mySQL

      Just had the same problem

      Check your firewall settings

      You may need to add an exception for port 3306

      Comment

      • Bassem
        Contributor
        • Dec 2008
        • 344

        #4
        Same problem here, I reconfigured the MySQL and set the default port 3306, add exception to the firewall, allow remote connection from other machines.

        My application was running successfully, but suddenly got this error again, tried the same procedure but didn't work!!

        Any one has another idea?

        Comment

        • finked1973
          New Member
          • Jun 2009
          • 20

          #5
          Can you ping the computer that your MySQL db is on from the computer where your app is ?

          This will prove whether connection is possible

          Comment

          • Bassem
            Contributor
            • Dec 2008
            • 344

            #6
            Thank you finked1973 for your reply.

            I can open the default website from the browser by typing the ip. This proves the connection is possible, right?

            Comment

            Working...