Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
PhpMyadmin situated in https://178.250.xxx.xxx/myadmin

C#
private void button1_Click(object sender, EventArgs e)
        {
 
            server = "178.250.xxx.xxx/myadmin";
            database = "test";
            uid = "test";
            password = "password";
            string connectionString;
            connectionString = "SERVER=" + server + ";" + "DATABASE=" +
            database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";";
 
            connection = new MySQLConnection(connectionString);
            connection.Open(); // show error
            MySQLCommand cmd;
            cmd = new MySQLDriverCS.MySQLCommand("select * from Code", connection);
            MessageBox.Show(cmd.CommandText);
            cmd.ExecuteNonQuery();
           
        }

MySQLDriverCS Exception: MySQLDriverCS Error: can't connect.Can't connect to MySQL server on 'localhost' (10061)
Posted
Updated 9-Jan-12 7:13am
v2

The only possible error I see might be your server string.
Just pass the ip to the connection without the path.
In case your server isn't listening on the default port (3306), you also should specify it (Port=xyz;)

Best regards
 
Share this answer
 
Comments
[no name] 9-Jan-12 13:55pm    
i use server = "178.250.xxx.xxx" without path too nothing change...
Maybe protocol is https??
SvenMe 9-Jan-12 14:07pm    
You're using https to connect to your instance of MySqlAdmin but not to connect to your database server.

The MySql server is running on your local machine or remotely?
[no name] 9-Jan-12 14:26pm    
its not local server. I want connect to remote server
SvenMe 9-Jan-12 14:44pm    
Strange that your error message says 'localhost'...
Just another question. Did you configure your MySql server to allow TCP connections from hosts other than localhost? I think by default it is not allowed. You could try the following from your computer

telnet SERVERIP 3306
[no name] 9-Jan-12 14:59pm    
i test port - it is opened..
Re-check the connection string using: http://www.connectionstrings.com/mysql[^]
 
Share this answer
 
Comments
[no name] 9-Jan-12 15:02pm    
connection string is valid
Wendelius 9-Jan-12 15:12pm    
Based on your error (Can't connect to MySQL server on 'localhost' (10061)) and the info that you're not actually using localhost but remote host it sounds like the connection string is referring to local host.

What if you try the following format:
Server=ipaddress;Port=3306;Database=test;Uid=test;Pwd=password
[no name] 9-Jan-12 15:25pm    
server = "178.250.xxx.xxx";
database = "database";
uid = "Login";
password = "Password";
port ="3306";


connectionString = "Server=" + server + ";" + "Port=" +
port + ";" + "Database=" + database + ";" + "Uid=" + uid + ";" + "Pwd=" + password + ";";
[no name] 9-Jan-12 15:26pm    
MySQLDriverCS Exception: MySQLDriverCS Error: can't connect.Can't connect to MySQL server on 'localhost' (10061)
SvenMe 9-Jan-12 15:35pm    
Hm OK. Now I see your problem.. Your connection string is wrong :P

You're using MySQLDriverCS connector and not the official one. Didn't recognized it till now.

Your connection string should look like this:

Location=myServerAddress;Data Source=myDataBase;User ID=myUsername;Password=myPassword;Port=3306;Extended Properties="""";

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900