Reputation: 368
I'm using MySql database
Here is my code:
mysqlconn = New MySqlConnection
mysqlconn.ConnectionString = "host= 192.168.1.52; server=127.0.0.1; port=3306; userid=root; password=; database=dbfsesmis"
I want to access my database from another computer what's wrong with the code above?
Upvotes: 2
Views: 963
Reputation: 2278
Suppose your MySQL server is hosted on: 192.168.1.52
method 1: telnet from another pc to 192.168.1.52 and connect server to 127.0.0.1 and you do not need to change any MySQL user permissions.
Method 2: connect directly from another pc [eg 192.168.1.123] to 192.168.1.52
in this case you need to setup user permission from 192.168.1.123 or use widecat 192.168.1.%
So your host-pc: mysql.user will have a record looks like:
Host = 192.168.1.%
User = ...
...
Upvotes: 0
Reputation: 1864
mysqlconn = New MySqlConnection
mysqlconn.ConnectionString = "host= 192.168.1.52; server=127.0.0.1; port=3306; userid=root; password=; database=dbfsesmis"
while the server should be the IP/domain to your database.
Let's say I am developing at 127.0.0.1
and the SQL server is located at 192.168.1.52
, the connection string should be mysqlconn.ConnectionString = "server=192.168.1.52; port=3306; userid=root; password=; database=dbfsesmis"
Upvotes: 1