Click here to Skip to main content
15,028,402 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have connected VB.net and mySQL on a the same PC before, but I have no Idea how to connect VB.net to a remote PC(LAN)

I've only changed the server

This is my code. I removed some of the details, but it works on server=localhost

(Toggle Plain Text)
conn = New MySqlConnection()
conn.ConnectionString = "server=192.168.1.4;" & _
"user id=root;" & _
"password=;" & _
"database=system"

Try
conn.Open()
MsgBox("You have control")
conn.Close()
Catch ex As Exception
MsgBox("Connection Failed")
End Try

I have turned off firewalls from both sides, and it keeps returning "Connection Failed"
Posted

1 solution

Was the MySQL installation configured to allow TCP/IP connections, this is a good example for installing MySQL on a Windows system[^].

Try one of the admin tools that are available[^] and see if it can connect to your remote server.

If MySQL is configured correctly the next thing is your connection string[^] which one you use is dependent on which MySqlConnection you are using.

Some connection string exmaples are:
The standard MySQL supplied connection it should be;
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

If you are using the one created by the MySQLDriverCS project team it would be;
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