Skip to content

Mysql connection

ferhat gursu

Asked Apr 9, 2007, 1:45 PM EDT1 answer
Share
LinkedInX
i have 2 pc, a pc and b pc, a pc have mysql database,b pc have a program, the program connection mysql databaso on the a computer.

cnn=new MySql.Data.MySqlClient.MySqlConnection("Network Address="+ this.textBox2.Text +";Database="+ this.textBox3.Text +";User Name='"+ this.textBox4.Text +"';Password='" + this.textBox5.Text + "'");

mysql ip number on the localhost 127.0.0.1 and this pc ip number 192.168.1.5
network address=?
which ip number can i use?
what can i do?

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Code
    
    Hi,
    
    Firstly, you should have a look at connectionstrings.com at this specific url : http://www.connectionstrings.com/?carrier=mysql
    
    There you could see that the connection string format for a MySqlConnection in .NET is "Data Source=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Command Logging=false;"
    
    In this connection string, you would set the Data Source to your mysql server's public ip address (192.168.1.5), the database name, username and password.
    
    But still, if your actual connection string works, you would want to set the Network Address to 192.168.1.5.
    
    Hope this helps!
    Simon
    0