Mediator
Mediator

Reputation: 15378

Unable to connect to any of the specified MySQL hosts

I work in C # through MySQL.Data.dll. Normally, all works fine, but sometimes it pops up an error "Unable to connect to any of the specified MySQL hosts". What is this error and how to get rid of it?

Upvotes: 3

Views: 17262

Answers (3)

Southern Fire
Southern Fire

Reputation: 171

I was having a having a hard time connecting to a MySQL database on HostGator through port while debugging locally. What worked for me was to change the trust level in my local web.config from medium to full.

<system.web>
    <trust level="Full" />
</system.web>

Upvotes: 0

Thiru G
Thiru G

Reputation: 630

You may check mysql server is working or not and you can add port number of mysql in connection string like this

    "Server = myServerAddress;
       Port = 1234;
   Database = myDataBase;
        Uid = myUsername;
        Pwd = myPassword;"

Upvotes: 6

Lloyd
Lloyd

Reputation: 2942

Can you connect to the MySql Host through MySql Workbench?

Using the same connection parameters in your application do you get the same error?

Have you setup the user account, access, schema and roles as required?

The standard port used for connections is 3306, you can change this via the configuration settings, on a local pc look for the 'my.ini' file in the root installation directory.

Upvotes: 0

Related Questions