2

I am trying to set up a local repo of Magento on Windows that will connect to a remote database running on CentOS. The CentOS server has the full LAMP stack and Magento installed and running. The local Windows machine has Apache, PHP and Magento installed. All I was to do is change my local.xml file on the Windows machine to point to the remote database running on the CentOS server. I changed the local.xml file to point to the server IP with the magento db user/pass, but I keep getting the following error:

SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

I can SSH to the CentOS database, but I can't figure out how to make Magento connect to it. Any ideas?

3
  • mysql -u fooUser -p -h 44.55.66.77 – camdixon Jul 1 '16 at 4:10
  • Have you done the above command and connection is valid? If you can SSH it stands to reason the problem is in your db config file or your username when logging into the actual mysql. – camdixon Jul 1 '16 at 4:11
  • @camdixon that might or might not be true. Being able to login via SSH is not the same as being able to remotely login to MySql. – mbalparda Jul 1 '16 at 14:35
4

This is probably not a Magento problem but something you didn't configure in your remote server. Most of the time MySql servers only accept connections from localhost or 127.0.0.1 and this is not the case.

Here you can find a guide to allow remote connections to your server, but please keep in mind this will expose your DB to the entire internet if not configured correctly.

4
  • I followed that already, same problem persists. Port 3306 seems to be open – Justin Hollender Jun 30 '16 at 23:17
  • Are you sure you are using your public centos server ip in your local local.xml? – mbalparda Jun 30 '16 at 23:20
  • Yes, I can load the CentOS magento page by the same IP – Justin Hollender Jun 30 '16 at 23:29
  • Your hosting provider blocking this maybe? – mbalparda Jun 30 '16 at 23:35
0

I figured it out finally. For some reason, CentOS wasn't using my iptables rules. It had another firewall that I had to adjust to allow port 3306. Thanks for the help!

1
  • Please remember to mark this answer as accepted. – mbalparda Jul 2 '16 at 16:25

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.