locked
c# Mysql + phpmyadmin issue RRS feed

  • Question

  • ok i have been trying to create a login form for like 3 days now but i cant seem to make a connection to server it comes up with the following error on connection.open()

    {"Unable to connect to any of the specified MySQL hosts."}

    i do have a webserver connected to my url and a2hosting do have a phpmyadmin option created a db and added in 

    id

    username

    password

    machineid

    but not sure how to get the data for the connection string as i not ever really done this before followed multiple guides to make login screen with MySQL and phpmyadmin but just cant make the connection 

    what i have as connection string.

                server = "xxxx";
                database = "elfenliexxxxxx";
                uid = "root";
                password = "";
    
                string connString;
                connString = $"SERVER={server};DATABASE={database};UID={uid};PASSWORD={password};";
    
                conn = new MySqlConnection(connString);
    the xxxx parts i have got rid of certain parts, i just not sure how to make connection and how i could get the info to create the string correctly. and not sure where the dump file is ( i assume when you make one there is some way of accessing where it stores all data like ini but not sure if it exists or where it would be if it did exist ) 

    Monday, July 27, 2020 1:11 AM

All replies

  • Try modifying your connection string to OLEDB style or MySQL Connector style and see if it helps.

    However, I recommend you to check whether you can connect to the server with MySQL Workbrench and see whether you're blocked by firewall.

    You'll also want to check your my.ini/my.cnf of the MySQL server and see if there is "bind-address" option that make it bind to 127.0.0.1 only.

    Monday, July 27, 2020 3:44 AM
    Answerer
  • Hi

    What is the driver you used like MysqlClient or oldb.

    Your connection string like oldb .But for MysqlClient the connection string like bellow

    "server=127.0.0.1;uid=root;pwd=12345;database=test"

    the ip 127.0.0.1 is for localhost

    http://net-informations.com/q/faq/mysql.html

    Thanks and regards


    Wednesday, July 29, 2020 3:10 PM