Tuesday, July 25, 2017

[google-cloud-sql-discuss] Re: DB_HOST

Hi - i am hoping this forum is still open for posts
I am experiencing a similar problem although not relating to Wordpress

I created a micro VM on Compute engine and created a LAMP stack
I uploaded my script which required an MySQL database created locally. All works fine

I then created 2 instance on Google SQL( First Generation and Second Generation with a database in each.
Following the documentation i set up credentials to allow access as well as making necessary adjustments to phpMyAdmin script so that i can access these databases from 
<myIPaddress>/phpMyAdmin

All good

BUT

Now i am stuck with actually connecting the web page to the remote Google SQL instance+database
I believe I am posting the HOST credentials incorrectly

Credentials are in a config.php file in path in the root folder var/www/html/includes/config.php

normally i have [excerpt]

$CONF = $TMPL = array();

// The MySQL credentials
$CONF['host'] = '"localhost"';
$CONF['user'] = 'username';
$CONF['pass'] = 'pwd';
$CONF['name'] = 'databasename';


i am using 

$CONF['host'] = ':/cloudsql/jinguru-live:europe-west1:jdb-gcpsql-002a';

When i try to load up the webpage i get

Failed to connect to MySQL: (2005) Unknown MySQL server host '":/cloudsql/jinguru-live:europe-west1:jdb-gcpsql-002a"' (2)Error:

Please let me know what i am doing wrong!!
I can provide further details re the Google Compute Engine and Google SQL credentials

THanks







On Monday, 17 October 2016 21:42:53 UTC+1, Alex (Cloud Platform Support) wrote:

Hi Salim,


Depending on your environment, you have several options available to you in the following link for connecting to your Cloud SQL instance. As in the subsection "Configure access to your Cloud SQL instance", you may have to authorise the IP address of the client machine where your MySQL client is installed.


To answer your question about setting up the DB_HOST variable, again depending on your environment(Wordpress site hosted on Google App Engine) you may be able to fix your redirect issue by setting it to ':/cloudsql/[YOUR_PROJECT_ID]:[Instance Region]:[Instance name]' as in the following "Setting up the WordPress project" link.


Alternatively, it is possible that the redirect can be caused by a plugin within the Wordpress environment. In that case, the best remedial action is to test each plugin individually after disabling them all.


In case none of the previous solutions works, please provide the following information about your set up:

- The generation of the Cloud SQL instance that you are using

- Where you are hosting your Wordpress Site

- The exact value of the DB_HOST that you have set

- Which version of MySQL are you using


Let me know if you're able to resolve it and share your setup infos if need more help with connecting to the Cloud SQL instance.


On Monday, October 17, 2016 at 9:45:43 AM UTC-4, Salim Karim wrote:
hi,

i am trying to run Wordpress with Cloud SQL.

I need to know what the DB_HOST should say?

currently it is set to the IP of Cloud SQL but I get 'redirected you too many times.'




Did you receive      service?
Feel free to leave a Google Review
Not Happy? Please contact our CEO


Connect with us: 

    

Please consider the environment before printing this email.

 

This e-mail and any attachments to it (the "Communication") is, unless otherwise stated, confidential,  may contain copyright material and is for the use only of the intended recipient. If you receive the Communication in error, please notify the sender immediately by return e-mail, delete the Communication and the return e-mail, and do not read, copy, retransmit or otherwise deal with it. Any views expressed in the Communication are those of the individual sender only, unless expressly stated to be those of National Training and Solutions Provider Pty Ltd ABN 34 123 831 023, or any of its related entities. NTSP does not accept liability in connection with the integrity of or errors in the Communication, computer virus, data corruption, interference or delay arising from or in respect of the Communication.

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/a65b4b00-cee3-4b34-ac65-9e9ab9c60d1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment