How to connect a C# Windows Forms Application to MySQL Database Hosted in GearHost?


#1

Hello, I’m trying to establish the connection from a C# application using the classic MySqlConnection object, but I have a problem “MySql_native_password”.

Solved!


#2

I don’t think you can connect to the SQL server from a C# Windows app unless you create a web service to handle the requests first. I could be mistaken, but the Gear Host docs don’t say anything about connection to the database outside of the web app.


#3

Not mysql, but… I’m able to connect to mssql with ssms. So based on that, I think desktop apps should be able to connect.


#4

Alright so you need to modify your connection string so that it matches the one that you’re using in SSMS. I think there is a way to copy the connection string from SSMS so that you can use it elsewhere.


#5

HELLO I HAVE THE SAME PROBLEM I WANT TO CONNECT A C# APLICATION TO GEARHOSTS FREE DATABASE IM ALLOWED TO DO THAT? HOW I DO ? SYNTAX/CODE ? thanks bestregards


#6

Hello,

Yes you can do this. We have a few connection string examples here: https://www.gearhost.com/documentation/connection-strings


#7

very good example !!! the connection work!
now i must Create/Read/delete/update (CRUD) users:
users have:
string FirstName
string LastName
string Email
String Password
String Contact
how i can create a table for free database to populate the Db with few data and then read Data from data base