Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 469
  • Last Modified:

website error

we imported a website and database from a hosted environment to a web server here in our office and when ever we launch the web site we get this error "SQLSTATE[HY000] [2003] Can’t connect to MySQL server on ‘xxx.xxx.xxx.xxx’ (13)" we checked the settings.php file on the web server but everything looks to be ok. Can you please tell me what settings should be in the settings.php file
0
dcircolone
Asked:
dcircolone
  • 6
  • 3
  • 2
1 Solution
 
dcircoloneAuthor Commented:
I should mention that I can connect to the database using the user name and password that are in the setting.php file from the web server to the database server, we are using PHP 5.3.3, CentOS 6.4, mysql 5.6, drupal 7
0
 
dcircoloneAuthor Commented:
This is the exact error

PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'xxxx.xxxx.xxxx (13) in lock_may_be_available() (line 165 of /var/www/pathapi/includes/lock.inc
0
 
chrisveeCommented:
in settings.php  you have to replace ip address xxxx.xxxx.xxxx  to  " localhost "

anyway send me your settings.php file once.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
dcircoloneAuthor Commented:
even if the database isn't on the local host?
0
 
Dave BaldwinFixer of ProblemsCommented:
If your MySQL database is on Godaddy, you had to set it up for remote access when you created it or you will not be able to get to it from 'outside'.  Other hosting companies have similar restrictions.
0
 
chrisveeCommented:
yes. i agree with @DaveBaldwin. remote access is not allowed almost in all hosting services.
0
 
dcircoloneAuthor Commented:
we are currently hosting both the database and webserver in our datacenter, they used to hosted at a university ( we are a medical association ) but we moved the web site and database here to our office, we moved 3 sites total 2 of the sites are on server 2008 R2 using IIS and PHP, these sites can connect to the database with no issues. The site in question is on CentOS 6.4 , Apache, PHP but when we try to go to the site is when we get the error.

I can connect to the database server from the CentOS web server using the mysql command.
The database is hosted on a windows 2008 server.
0
 
Dave BaldwinFixer of ProblemsCommented:
Which machine is the MySQL database on?  You need to see if the username and password you are using is allowed to connect from the CentOS server.
0
 
dcircoloneAuthor Commented:
I found the answer, we had to run this command on our CentOS web server
"setsebool -P httpd_can_network_connect 1" and then we were able to connect the web server to the database server
0
 
Dave BaldwinFixer of ProblemsCommented:
Ok, that's a new one on me.  Never had that problem on my Ubuntu Linux servers.  I see that is part of SELinux which I don't run.  http://linux.die.net/man/8/setsebool
0
 
dcircoloneAuthor Commented:
I was able to find the solution by researching on line, none of the experts answers solved the issue, I appreciate the help you give on most issue though
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now