102

I use MySql.Data 8.08 and .NET Core to connect to MySql 5.7.18 but following exception is being thrown:

MySql.Data.MySqlClient.MySqlException:“The host localhost does not support SSL connections.”

How to deal with it?

1

2 Answers 2

229

I had the same problem today when moving from MySql.Data 7.0.7 to 8.0.8. I was able to move forward adding the "SslMode=none" in the connection string.

You will endup with something like:

server={0};user id={1};password={2};persistsecurityinfo=True;port={3};database={4};SslMode=none

(replacing the values with your database details)

Sign up to request clarification or add additional context in comments.

6 Comments

thanks. It worked,must Added SSL for negative like SslMode=none
trying to force SSL connection is a good idea but breaking people code assuming they would have SSL available is not! If I had SSL I would use it already!
Thanks for this information. I too was facing runtime error on live server without an hint how to move-on, because everything worked properly on local/dev. I have consolidated all the issue I've faced during Mysql client 6.x to 8.x migration in this article. Hope this saves time.
Disable SSL connection brake security roles. So in my opinion thoes solution fix that issue ONLY for dev purposes not for production
Faced this error after migrating from .Net Core 3.1 to .Net 5.0
|
2

And if you using a connection pool class, then you might have to do this way:

    string connstring = string.Format("Server=44.55.110.59; database={0}; UID=root; password=Newuser@123; SslMode = none", databaseName);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.