Error establishing a database connection

702 views
Skip to first unread message

Jun Leong Wong

unread,
Mar 27, 2020, 9:21:20 AM3/27/20
to Google Cloud SQL discuss
Hi,

I have successfully imported my sql into Google Cloud SQL (MySQL).

I migrated the database to Google Cloud SQL but the whole Wordpress files still remain on my own server.

I have edited the wp-config.php as follow:


/** MySQL database username */
define('DB_USER', 'myuser');  // this is the username under master instance > username

/** MySQL database password */
define('DB_PASSWORD', 'mypass');  // this is the password under master instance > username

/** MySQL hostname */
define('DB_HOST', '35.227.86.242'); // under Connect to this instance > Public IP address > 35.227.86.242

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', 'utf8_general_ci');



But it doesn't work.

I got Error establishing a database connection message.

Helps needed.

Thanks.

Pierre-Yves (Google Cloud Support)

unread,
Mar 27, 2020, 11:41:46 AM3/27/20
to Google Cloud SQL discuss
Hi Jun,

There was an incident that affected Cloud SQL instances between 2020-03-26 18:17 and ended at 2020-03-27 06:57 UTC-7.
Since the issue is now resolved, please try the migration again. If you still experience errors, please provided the full console output for the error, while obfuscating sensitive information.

Jerome Chevreau

unread,
Mar 27, 2020, 2:01:05 PM3/27/20
to Google Cloud SQL discuss
Hi,

Have you tried to connect using a tool such as MySQLWorkBench and test the connection.
Also, check whether or not the the port setting is set to 3306.
Have you also set DB_NAME?

Thanks

Jun Leong Wong

unread,
Mar 28, 2020, 12:29:57 AM3/28/20
to Google Cloud SQL discuss
https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!topic/google-cloud-sql-discuss/9CxXepaLziI

Hi,

Thanks for quick respond. It has nothing to do without that incident.

After adding CIDR notation /32 into my ip and restarted my instance, it finally works now.

Thanks a lot.

Have a great day.
Reply all
Reply to author
Forward
0 new messages