I was wondering how one might go about setting the local.xml file (if it's even possible) for a Magento install to connect to a MySQL server over a secure connection.

I currently have my webserver and MySQL server hosted on different machines (in the Amazon Web Services cloud), and so I wanted to make sure that Magento communicates with the database over a secure connection.

Unfortunately so far I can't seem to find any workable answers for this, and considering how important security is for ecommerce sites, I would think this sort of configuration would be available in Magento out of the box.

I know from the command line you can invoke a mysql secure connection to Amazon with the following sort of example statement:

mysql -h myinstance.amazonaws.com --ssl_ca=rds-ssl-ca-cert.pem --ssl-verify-server-cert

Where rds-ssl-ca-cert.pem is a reference to the public key.

I guess I was thinking Magento must make a similar call using the local.xml file, and that there ought to be a way to similarly invoke the secure connection.


Yeah Surely you can do that,

just edit the following entries of your magentoroot/app/etc/local.xml file like this:

    <initStatements><![CDATA[SET NAMES utf8]]></initStatements>

Don't forget the port no after the Hostname.

And yes, dont forget to change the inbound rule of the security group that is attached to your RDS instance. enable the traffic from your local servers IP.

| improve this answer | |
  • Hi and thanks so much for the answer, I read it but wasn't sure how it was different from a normal unsecure connection to an external mySQL database. The only difference from what I had was the port :3306, but from what I'm seeing that's a normal TCP/UDP port for mySQL, is that right? I'm just wondering to make sure it's secure. – Zero Wing Apr 7 '15 at 13:27
  • perfect answer!!! +1 :) – SagarPPanchal Dec 10 '17 at 9:50
  • This does not solve the problem that Magento1.x cannot connect to a remote mysql database using a certificate. – CarComp Jan 26 '18 at 13:40

There is no way to do this the way you want. I suggest you to check this answer, it seems to be similar and have a couple of methods to try at least.

| improve this answer | |
  • No built-in way... – CarComp Jan 26 '18 at 13:40

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.