I am trying to use mysqlconnector to connect with SSL to my database. I get the error in the title. I am using version 6.9.6 of the connector.
**my.cnf**
[mysqld]
ssl
ssl-ca=/etc/mysql/ca.pem
ssl-cert=/etc/mysql/server-cert.pem
ssl-key=/etc/mysql/server-key.pem
ssl-capath=/etc/mysql/
ssl-cipher=DHE-RSA-AES256-SHA
**Showing that SSL is enabled.**
+---------------+----------------------------+
| Variable_name | Value |
+---------------+----------------------------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | /etc/mysql/ca.pem |
| ssl_capath | /etc/mysql/ |
| ssl_cert | /etc/mysql/server-cert.pem |
| ssl_cipher | DHE-RSA-AES256-SHA |
| ssl_key | /etc/mysql/server-key.pem |
+---------------+----------------------------+
7 rows in set (0.00 sec)
I can connect locally with the following command.
mysql --ssl-ca=ca.pem --host=127.0.0.1 --user=ocnuser --password
I can verify my connection has encryption after logging in, with that command.
+---------------+--------------------+
| Variable_name | Value |
+---------------+--------------------+
| Ssl_cipher | DHE-RSA-AES256-SHA |
+---------------+--------------------+
1 row in set (0.01 sec)
However, using this VB.NET code, I cannot open a connection.
Dim MysqlConn As MySqlConnection
Dim connStr As String = "server=192.168.1.2;user id=ocnuser;password=passwordgoeshere;database=OCN;Certificate Store Location=CurrentUser;SSL Mode=Required"
Dim msc As New MySqlConnection
Try
msc.Open()
Catch ex As Exception
MsgBox("There was a problem connecting to the database.", MsgBoxStyle.Exclamation)
End Try
I can connect with MySQL Workbench from a remote PC, assuming I point to the CA File.
Perhaps I imported the wrong file to my store. Which file am I supposed to import in order to make a connection? I also do not have any client certs or keys (was instructed I didn't need them for my situation). I also have read .NET doesn't do .PEM, but .PFX.
I also got `error 18 at 0 depth lookup:self signed certificate` when I ran `openssl verify` on my `server-cert.pem`. Not sure if that has anything to do with this.
**my.cnf**
[mysqld]
ssl
ssl-ca=/etc/mysql/ca.pem
ssl-cert=/etc/mysql/server-cert.pem
ssl-key=/etc/mysql/server-key.pem
ssl-capath=/etc/mysql/
ssl-cipher=DHE-RSA-AES256-SHA
**Showing that SSL is enabled.**
+---------------+----------------------------+
| Variable_name | Value |
+---------------+----------------------------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | /etc/mysql/ca.pem |
| ssl_capath | /etc/mysql/ |
| ssl_cert | /etc/mysql/server-cert.pem |
| ssl_cipher | DHE-RSA-AES256-SHA |
| ssl_key | /etc/mysql/server-key.pem |
+---------------+----------------------------+
7 rows in set (0.00 sec)
I can connect locally with the following command.
mysql --ssl-ca=ca.pem --host=127.0.0.1 --user=ocnuser --password
I can verify my connection has encryption after logging in, with that command.
+---------------+--------------------+
| Variable_name | Value |
+---------------+--------------------+
| Ssl_cipher | DHE-RSA-AES256-SHA |
+---------------+--------------------+
1 row in set (0.01 sec)
However, using this VB.NET code, I cannot open a connection.
Dim MysqlConn As MySqlConnection
Dim connStr As String = "server=192.168.1.2;user id=ocnuser;password=passwordgoeshere;database=OCN;Certificate Store Location=CurrentUser;SSL Mode=Required"
Dim msc As New MySqlConnection
Try
msc.Open()
Catch ex As Exception
MsgBox("There was a problem connecting to the database.", MsgBoxStyle.Exclamation)
End Try
I can connect with MySQL Workbench from a remote PC, assuming I point to the CA File.
Perhaps I imported the wrong file to my store. Which file am I supposed to import in order to make a connection? I also do not have any client certs or keys (was instructed I didn't need them for my situation). I also have read .NET doesn't do .PEM, but .PFX.
I also got `error 18 at 0 depth lookup:self signed certificate` when I ran `openssl verify` on my `server-cert.pem`. Not sure if that has anything to do with this.