Website cannot connect to Google Cloud SQL post name server change

50 views
Skip to first unread message

Mote Net

unread,
Feb 14, 2018, 10:36:19 PM2/14/18
to Google Cloud SQL discuss
Hi all,

Up until recently we have been successfully using the Google Cloud SQL in one of our projects and have been able to present the data on our website. However, after a recent name server change with our server providers, our website can no longer connect to the database. I have confirmed that it is accessible using other systems, and we made sure that the new IP address is listed in the authorised list. SSL on or off doesn't seem to matter.
Are there any suggestions on how to fix this problem?

Mote Net

unread,
Feb 15, 2018, 9:01:20 AM2/15/18
to Google Cloud SQL discuss
I should add the specific error being reported: 

<br />

<b>Fatal error</b>:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'XXX.XXX.XXX.XXX' (111 &quot;Connection refused&quot;)' in /home/XX/public_html/wp-content/themes/theme/page-templates/Devices.php:22

Stack trace:

#0 /home/XX/public_html/wp-content/themes/theme/page-templates/Devices.php(22): PDO-&gt;__construct(dsn,user,pass)

#1 /home/XX/public_html/wp-includes/template-loader.php(74): include('/home/XX/publ...')

#2 /home/XX/public_html/wp-blog-header.php(19): require_once('/home/XX/publ...')

#3 /home/XX/public_html/index.php(17): require('/home/XX/publ...')

#4 {main}

  thrown in <b>/home/XX/public_html/wp-content/themes/theme/page-templates/my_template.php</b> on line <b>XX</b><br />

Private information scrubbed where appropriate

Dinesh (Google Platform Support)

unread,
Feb 15, 2018, 12:24:38 PM2/15/18
to Google Cloud SQL discuss

Hello,


Are you trying to say that SQL DB is accessible using other systems? You may test this by trying to connect SQL DB from any DB client tool on the remote network.

Looking at the error message, have you updated contents of the 'settings.php' post changes? You may want to follow recommendations suggested in this document[1]


[1]:https://www.drupal.org/forum/support/post-installation/2011-07-19/pdoexception-sqlstatehy000-2003-cant-connect-to-mysql


Mote Net

unread,
Feb 18, 2018, 7:46:54 PM2/18/18
to Google Cloud SQL discuss
I should clarify that we are using wordpress and that this isn't the wordpress database in use. This is a database for some additional data used by some content on our website.

Mote Net

unread,
Feb 18, 2018, 7:47:46 PM2/18/18
to Google Cloud SQL discuss
Also forgot to add, yes the SQL DB is accessible from any other system we use, just not our website.

Dinesh (Google Platform Support)

unread,
Feb 19, 2018, 11:42:43 AM2/19/18
to Google Cloud SQL discuss

As SQL DB is accessible from other systems, it indicates issue lies in your website configuration. Have you checked the configuration in “settings.php” files as indicated in the previously shared post?


Going forward, can you please send me the complete error logs through private message?


Reply all
Reply to author
Forward
0 new messages