Connection errors from WordPress to Azure MySQL database

Issue: You are getting connection issues to your hosted Azure MySQL database server. You are putting the correct information in, but still WordPress is showing Error Connecting to Database.

Error: After some investigation, you most likely are getting this error:

mysqli_real_connect(): (HY000/9002): SSL connection is required. Please specify SSL options and retry

Resolution: Believe it or not, this is a simple one. Azure REQUIRES that your connection to the database uses SSL.

Simply put the following line in your wp-config.php file and all will be well. I typically include a description for my own reference

/** Secure Connection to Azure MySQL db */
define(‘MYSQL_CLIENT_FLAGS’, MYSQLI_CLIENT_SSL);

Leave a Reply

Your email address will not be published. Required fields are marked *

*