Hi @Brian,
While the native mysql function in MATLAB does not directly support SSL options, using the JDBC driver provides a viable alternative for connecting to a MySQL database that requires secure transport. By specifying the appropriate connection properties, you can successfully establish a secure connection to your Azure MySQL database. Here’s how you can do it:
% Load the JDBC driver
jdbcDriver = 'com.mysql.cj.jdbc.Driver';
% Update with the path to your MySQL JDBC driver
javaaddpath('path_to_mysql_connector_java.jar');
% Define connection properties
dbURL = sprintf('jdbc:mysql://%s:%d/%s?useSSL=true&requireSSL=true', ...aosDbSettings.Server, aosDbSettings.PortNumber,
aosDbSettings.DatabaseName);
connProps = java.util.Properties();
connProps.setProperty('user', aosDbSettings.UserName); connProps.setProperty('password', aosDbSettings.UserPassword);% Establish the connection
conn = database('', '', '', jdbcDriver, dbURL, connProps);In this code, replace path_to_mysql_connector_java.jar with the actual path to your MySQL JDBC driver. The connection URL includes parameters useSSL=true and requireSSL=true, which enforce SSL usage. For more guidance, I will suggest the following link to help you out as well.
Also, make sure that the SSL certificates are correctly set up. You may need to provide the paths to the CA certificate, client certificate, and client key in the connection string if required. Hope this should help resolve your problem. If you encounter further issues, consider exploring the MATLAB Database Toolbox
https://www.mathworks.com/help/database/ug/choose-between-odbc-and-jdbc-drivers.html
or consulting with MathWorks support for additional assistance.