Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
How to connect to a remote MySQL server using C#?
Jim Tat
Oct 27 2016 10:36 AM
363
Reply
I have a C# Application which would access a MySQL server using WAMP on another computer. I am trying to do it via IP. Here is my Connection String :
server =
"192.168.10.221"
;
database =
"restaurantdb"
;
uid =
"root"
;
password =
""
;
string
connectionString;
connectionString =
"SERVER="
+ server +
"; PORT = 3306 ;"
+
"DATABASE="
+ database +
";"
+
"UID="
+ uid +
";"
+
"PASSWORD="
+ password +
";"
;
mycon =
new
MySqlConnection(connectionString);
I have another computer in which we are in the same network, but when I try to connect to the Mysql I am not able to connect but locally it works...
What do you think ?
What I have tried:
I published my C# application and then launch it in the other computer so that I will try to connect to mysql but nothing works. But I have to mention that when I put the ip adress in the other computer I can have access to wampserver and phpmyadmin ...
I got this error: .MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified MySQL hosts.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to Clone a Class instance without reference?
Help in decision for C# development.