简体   繁体   中英

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?

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;"

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>

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM