Tuesday, July 25, 2017

Re: [google-cloud-sql-discuss] Google Compute Engine VM connection to Google SQL Instance

Hi,

As I mentioned in my other email, those instructions are for Google App Engine. On Google Compute Engine, you have two options:
  1. Connect to the public IP address of your Cloud SQL instance. This requires you whitelist your GCE instance on the ACL for the Cloud SQL instance.
  2. Use the Cloud SQL proxy. This is a extra daemon you run on your GCE instance that allows you to connect via TCP on localhost or a socket.
Complete instructions for both of these options are available at https://cloud.google.com/sql/docs/mysql/connect-compute-engine.

On Mon, Jul 24, 2017 at 7:28 PM, jinguruxxx <jinguruxxx@gmail.com> wrote:
Hi
I seem to have a problem configuring a config.php which basically connects my website on the VM to an SQL database on Google SQL

I also have phpMyAdmin successfully installed and can access it via <VM_IPAddress>/phpMyAdmin

In turn, i have also successfully configured phpMyAdmin so that i can log in to the localhost database and the my Google SQL database.
This part of the process i have performed successfully for both First Generation and Second Generation instances

The part which is causing me headache is the seemingly simple addition of credentials to the config.php on my Google VM instance which needs to point to the relevant database.,

I'm sure you are familiar with this format:


// The MySQL credentials
$CONF['host'] = 'localhost';
$CONF['user'] = 'user';
$CONF['pass'] = 'password';
$CONF['name'] = 'database name';


$CONF['host'] = 'localhost'; is the part that is giving me a problem - i am normally used to just having it as localhost or pointing to a specific IP address
inputting the ip adress eg  34.125.258 of the database instance does not seem to work


seems to indicate 

$CONF['host'] = ':/cloudsql/project-id:region:sql-db-instance-name';
which for sake of example:
$CONF['host'] = ':/cloudsql/live-001:europe-west1:totaldata';

but this yields same result

Have i missed something?

Please assist! Getting quite frustrated by the process here and any help would be much appreciated!

Thanks in advance





--
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/6de8b295-89aa-4868-9a67-10b1f8c3c2dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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/CAJZK_bbuc60gYBMArONRUs139o%3D_DKxkHRDFfaNbQaMErmtG2w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment