0

I have a client who is getting the error:

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (4)' in /htdocs/library/rb.php:65

The really odd thing here is that it's not consistent... I can't even reproduce the error. Hitting refresh will, apparently, always bring requested page up without problems.

What could be causing this? Any ideas?

nicholas
  • 14,184
  • 22
  • 82
  • 138

2 Answers2

1

I would suggest you look at the mysql database, users table. Looks like the issue is specific to the host attempting to access the server.

Database users have the following 3 fields, username, password and host. Make sure the host for the user attempting to authenticate matches the IP of the machine trying to connect, or set it to % which is a wildcard.

Mike Mackintosh
  • 13,917
  • 6
  • 60
  • 87
  • It's even simpler than that. The site is running on a shared server. The host, dbname, username, and password supplied to R::setup() are just strings, not even variables pulled out of a config file. There's no way those are wrong, or the connection would fail every time. – nicholas Jun 08 '12 at 01:30
  • 1
    That is looking in the wrong spot. Look at your Privileges on the MySQL server itself, not the script connecting to it. – Mike Mackintosh Jun 08 '12 at 01:37
1

The problem was that the windows server does not have PDO mysql drivers installed.

Phd. Burak Öztürk
  • 1,727
  • 19
  • 29