free2idol1
free2idol1

Reputation: 320

cannot connect to Google Cloud SQL from localhost phpMyAdmin

I'd like to move all of my databases at my local database to Google Cloud SQL and followed this tutorial here: https://docs.bitnami.com/google/how-to/migrate-database-cloud-sql/ but when I made some addition to config.inc.php:

$i++;

$cfg['Servers'][$i]['verbose'] = 'Google Cloud SQL'
$cfg['Servers'][$i]['host'] = '35.247.134.165';
$cfg['Servers'][$i]['user'] = '***';//my username
$cfg['Servers'][$i]['password’] = '***';//my password
//$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['auth_type'] = 'cookie';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
//$cfg['Servers'][$i]['compress'] = TRUE;
$cfg['Servers'][$i]['AllowNoPassword'] = false;

and then reloaded the phpMyAdmin client webpage, but it showed a totally blank page...like this I don't know where it did wrong here... Thank you...

Upvotes: 0

Views: 1172

Answers (1)

Antonio Ramirez
Antonio Ramirez

Reputation: 1058

I have reviewed your configuration and identified where the issue lies.

The issue is in your auth_type statement, please look at my config.ini.php

<?php
$i=0;  
$i++;  
$cfg['Servers'][$i]['verbose'] = 'Google Cloud SQL'
$cfg['Servers'][$i]['host'] = '12.345.678.901';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password’] = 'root';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['AllowNoPassword'] = false;
?>

Furthermore when I was connecting phpmyadmin to Cloud SQL mysql I received timeouts because my instance was not allowing external connections. To solve this I did the following:

  1. I clicked on the name of my Cloud SQL instance
  2. Then I clicked on the tab Connections;here there is a section called 'Authorized Networks' under 'Public IP' checkbox.
  3. Finally I added the CIDR of my network or if you are only testing it for now, you can also add 0.0.0.0/0;be careful, the last CIDR value will allow any external network to try to connect to your Cloud SQL instance.

I hope you find this useful.

Upvotes: 2

Related Questions