Page 1 of 1

Can't connect to MySQL server on 'localhost' (10061)

Posted: Fri 30 Mar 2007 09:28
by zendic
I am new for using this software. :oops:

MySqlConnection myConn = new MySqlConnection("User Id=root;Password=password;Host=localhost;Database=disb_db");

myConn.Open(); (The error is occur from here).

How to solve this problem, I am using trial version and i am using debug to test. choose poket pc emulator 2003. Thx for help.

Re: Can't connect to MySQL server on 'localhost' (10061)

Posted: Fri 30 Mar 2007 09:53
by Serious
zendic wrote:User Id=root;Password=password;Host=localhost;Database=disb_db
Use IP address of MySQL Server host in the connection string.

Can't connect to MySQL server on 'localhost' (10061)

Posted: Mon 02 Apr 2007 00:29
by zendic
Still same the error. If i change the host to IP address of MySql Server Can't connect to MySQL server on '127.0.0.1' (10061).

Re: Can't connect to MySQL server on 'localhost' (10061)

Posted: Mon 02 Apr 2007 01:11
by zendic
zendic wrote:Still same the error. If i change the host to IP address of MySql Server Can't connect to MySQL server on '127.0.0.1' (10061).
My Code:

try
{
MySqlConnection myConn = new MySqlConnection("User Id=root;Password=password;Host=127.0.0.1;Database=disb_db");
myConn.Open();
MySqlCommand myCommand = new MySqlCommand("select * from m_stkmst", myConn);
myCommand.Parameters.Add("?", testText.Text);
Int64 count = Convert.ToInt64(myCommand.ExecuteScalar());
Console.WriteLine(count);
myConn.Close();

}
catch
{

throw;
}

Posted: Mon 02 Apr 2007 07:23
by Alexey
Use true IP address of your host instead of 127.0.0.1.

Can't connect to MySQL server on 'localhost' (10061)

Posted: Tue 03 Apr 2007 00:38
by zendic
I alr set my IP to True ip = 192.168.1.107.
The error is still same...
Any solution or example, Thanks.
I want to purchase the product if it is can use in the pocket pc.....

Posted: Tue 03 Apr 2007 06:03
by Alexey
Are you able to connect in design-time?
Are you able to connect to your MySQL Server using another client?
Do you have default port number (3306)?

Help

Posted: Mon 09 Apr 2007 07:04
by zendic
my default is 3307,
i have use other mysql server to call it but that is no problem.
I am using coding to call it.

Posted: Tue 10 Apr 2007 06:50
by Alexey
Did you set the port number in your connection string?
Are you able to connect in design time?
I've sent you a test program (zipped and renamed to *.txt) to ngeiji at gmail dot com. Specify your host address and port number and click Ping button. If you don't get MySQL Server's version then something wrong with your server.

Posted: Thu 19 Apr 2007 09:59
by Alexey
Any news? Did you run my application?

Posted: Wed 08 Aug 2007 09:46
by bwalmisley
Hi,

I'm having EXACTLY the same problem.

Until yesterday the application was connecting fine - it now connects at design time only.

Error message is:
Cant't connect to mysql server on 'localhost' (100061)

Username and password are correct.

Using the IP address (either 127.0.0.1 or the real IP address makes no difference).

I read username and password from the user

e.g.

Code: Select all

this.mySqlConnection1.Password = serverinformation.Password.Text;
                        this.mySqlConnection1.UserId = serverinformation.Username.Text;
                        
                        this.mySqlConnection1.Host = serverinformation.ServerName.Text;
                        this.mySqlConnection1.Database = serverinformation.Database.Text;                        
                        this.mySqlConnection1.Open();

The 'design code' is this:

Code: Select all

            this.mySqlConnection1.Compress = true;
            this.mySqlConnection1.ConnectionString = "User Id=linearuser;Password=lineartest;Host=localhost;Database=masons2;Compress=T" +
                "rue;Protocol=Tcp;";
            this.mySqlConnection1.Name = "mySqlConnection1";
            this.mySqlConnection1.Owner = this;
Edit: The connection can't be timing out because its returning with the error in less than a second.

I have tried deleting the MySQLConnection object and recreating it, but the same scenario repeats.

Posted: Wed 08 Aug 2007 10:18
by bwalmisley
And I've found the problem

I had edited my app.config file to try and enable JIT debugging yesterday.

So it was along these lines

Code: Select all



	somesettinghere = "1"

the variable 'somesettinghere' doesnt matter - can be anything

removing that line

Code: Select all



fixes the problem...