Does Craft CMS support MySQL over SSL?




As of the next Craft 2.6 release (post 2.6.2945), Craft has exposed an attributes database config setting that you can pass arbitrary PDO attribute key => value pairs into.

So, assuming your MySQL box is setup properly to use SSL and assuming the database user that Craft is using to connect to the box can connect over SSL, then you can do something like this to enable Craft to talk to MySQL over SSL:

'attributes' => array(
     PDO::MYSQL_ATTR_SSL_KEY    => '/path/to/my/client-key.pem',
     PDO::MYSQL_ATTR_SSL_CERT   => '/path/to/my/client-cert.pem',
     PDO::MYSQL_ATTR_SSL_CA     => '/path/to/my/ca-cert.pem',


In Craft 2.x, this isn't currently possible. Craft 3, however, will expose the necessary client side configs so that if your MySQL box has an SSL cert installed and supports SSL, then you can configure Craft to connect via SSL.

  • Thanks Brad. Do you have a link that documents the setup? I've looked on the craft website but can't find anything.
    – Gerhard
    Mar 16 '16 at 6:14
  • 2
    Craft 3 isn't even in beta, there's no documentation yet.
    – carlcs
    Mar 16 '16 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.