In this blog, we will learn how to connect ASP.NET (C#) application to MySQL Commercial version.
When we use MySQL Community edition, the SSL is disabled in that by default. When we execute the below command on MySQL command line, we get the below output. So, our ASP.NET application gets connected to MySQL successfully.
mysql> SHOW VARIABLES LIKE '%ssl%';
+---------------+----------+
| Variable_name | Value |
+---------------+----------+
| have_openssl | DISABLED |
| have_ssl | DISABLED |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | |
+---------------+----------+
9 rows in set (0.02 sec)
But when we use the commercial version, in that the SSL ciphers are enabled. Without adding the same ciphers in our application, we cannot communicate to MySQL database and get the following error.
Exception A call to SSPI failed, see inner exception.
Exception MSGSystem.ComponentModel.Win32Exception (0x80004005): The client and server cannot communicate, because they do not possess a common algorithm
If we fire the below command on MySQL command line, we get the below output.
mysql> SHOW VARIABLES LIKE '%ssl%';
+---------------+-----------------+
| Variable_name | Value |
+---------------+-----------------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | ca.pem |
| ssl_capath | |
| ssl_cert | server-cert.pem |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | server-key.pem |
+---------------+-----------------+
9 rows in set (0.00 sec)
If the below parameters are having value as "YES" that means SSL is enabled.
| have_openssl | YES |
| have_ssl | YES |
To bypass the SSL connection, we have to modify my.ini (My SQL configuration file present at the below location)
C:\ProgramData\MySQL\MySQL Server 5.6
Inside my.ini, go to [mysqld] section and add the below line.
[mysqld]
skip_ssl
# disable_ssl
After that, save the file and restart the MySQL service. Now, let's check whether SSL is disabled or not by executing the below command on MySQL command line.
mysql> SHOW VARIABLES LIKE '%ssl%';