C# is fine when calling mysql.data.dll to connect to the local database, but it reports an error when connecting to the mysql server on a remote Linux server
Error log, current connection string
System.Security.Authentication.AuthenticationException: Authentication to host ‘xxx.xxx.xxx.xx’ failed.
at MySql.Data.Common.Ssl.StartSSL(Stream& baseStream, Encoding encoding, String connectionString)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
<add key="dbString" value="server=localhost;port=3306;user=root;password=root; database=id3net" />
If the host does not support SSL connection, then SSL connection will not be used
Solution: add sslmode = none after the connection string.
<add key="dbString" value="server=localhost;port=3306;user=root;password=root; database=id3net;SslMode=none" />
Read More:
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- C# Connect MYSQL Error: MySql.Data.MySqlClient.MySqlException:“SSL Connection error.”
- The setobject() method reports an error. The parameter index out of range and MySQL syntax error exception report an error
- Problems in connecting mysql8.0 in IDEA [How to Solve]
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- [Solved] Mysql Build Error: [ERROR] Slave I/O for channel ‘‘: error connecting to master
- How to Solve MYSQL Error: Failed to start MySQL 8.0 database server
- Zabbix import MySQL database error ERROR 1046 (3D000) at line 1: No database selected
- Using Mybatis to connect to the database error: Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver···
- [Solved] Sqlyog always reports an error when creating a new connection.
- How to Solve c3p0 connect mysql8.0 Error
- IDEA maven Config MYSQL Connection Error: Could not create connection to database server.
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- MySQL Change password failure prompt: ERROR 1064(42000):You have an error in your SQL syntax: check the corresponds to your M
- [Solved] com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.
- MySQL Build table error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL ser
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used by doubl
- [Solved] SQLSTATE[HY000] [2002] Connection refused to report an error when PHP connects to mysql in the docker container
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘