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

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!

1 Like

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.

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.

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.

1 Like

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

Hello,

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

1 Like

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