Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...
I want to connect to mysql database through c#.I have write connection string as "SERVER=LOCALHOST;database=birthinfo;uid=root;password=;".
I got error as "unable to connect to any of the specified mysql hosts".

Thanks.
Posted

1 solution

Try setting up a connection in VS with the Server Explorer pane:
1) Open Server Explorer.
2) Right click "Data connections" and select "Add connection"
3) In the dialog that follows, select your DataSource, and database, specify the security info, and press the "Test connection" button.
4) When the connection works, press "OK"
5) Highlight your database in the Server Explorer pane, and look at the Properties pane. A working example of the connection string will be shown, which you can copy and paste into your app or config file.
 
Share this answer
 
Comments
Rohini Shirke 27-Dec-13 6:22am    
Hi...
Thanks for reply.
But In add connection dialog there is no option for mysql in data source list.only there is option for sql server,access databse.
Thanks
OriginalGriff 27-Dec-13 6:42am    
Try this:
http://www.mysql.com/why-mysql/windows/visualstudio/

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