One addition to this topic:
In some cases, when two computers are connected to the same network, the above connection string may still not work, despite the configuration of the source computer and the provision of privileges for the user from the client computer.
In such cases, please consider (before moving on and taking more serious actions on the source computer, for example, changing the Mysql configuration file, etc.) to "use the computer name as the server name instead of the IP address".
i.e.
- first grant privileges to the user as described above,
- but instead of the connection string suggested above, try the following connection string:
so the connection string will look like this:
server = "pc-name-whateveritis"; database = "restaurantdb"; uid = "root"; password = ""; string connectionString; connectionString = "SERVER=" + server + "; PORT = 3306 ;" + "DATABASE=" + database + ";" + "UID=" + uid + ";" + "PASSWORD=" + password + ";"; mycon = new MySqlConnection(connectionString);
The name of the source computer can work in many cases when the IP address of the source computer returns an error.
Good luck
source share