Google Cloud SQL and Vanilla Forum Database Error
I'm having problems connecting to my Google Cloud DB.
In debug mode for Vanilla Forums i'm getting this error:
Lost connection to MySQL server at 'reading initial communication packet'
I have tried the following combinations for Vanilla configuration in file: /forum/conf/config.php
$google_IPv4 = '***.***.***.***'; // Google IPv4 address $Configuration['Database']['Name'] = 'tpl_vanilla_forum'; $Configuration['Database']['Host'] = $google_IPv4; $Configuration['Database']['User'] = "username"; // client host % $Configuration['Database']['Password'] = '********';
AND
$google_IPv4 = '***.***.***.***'; // Google IPv4 address $Configuration['Database']['Name'] = 'tpl_vanilla_forum'; $Configuration['Database']['Host'] = $google_IPv4; $Configuration['Database']['User'] = "'username'@'%'"; // client host % $Configuration['Database']['Password'] = '********';
Also in file: /forum/library/database/class.database.php
I played with the Connection() function and commented out the original line and still same error:
$this->_Connection = new pdo('mysql:host=***.***.***.***;port=3306;dbname=tpl_vanilla_forum', 'username', '******', $this->ConnectionOptions); // $this->_Connection = new PDO(strtolower($this->Engine) . ':' . $this->Dsn, $this->User, $this->Password, $this->ConnectionOptions);
This doc explains connecting for Development using IPv4: https://cloud.google.com/appengine/docs/php/cloud-sql/#PHP_Connect_to_your_database
AND
This one explains Creating Users and Specifying Account Names: https://cloud.google.com/sql/docs/create-user
I have my server IP listed in Google Cloud SQL -> Access Control -> Authorization -> Allowed Networks. I assume if this was the issue the Database error thrown would read differently?
If you're familiar with Google Cloud SQL, any ideas? Thanks
Regards
-Hector
Comments
That doesn't look like an issue related to Vanilla. Have you looked at this already?
http://stackoverflow.com/questions/5755819/lost-connection-to-mysql-server-at-reading-initial-communication-packet-syste
My shop | About Me
I am with businessdad in thinking this isn't an issue with Vanilla, but a server misconfiguration. That said, you can explicitly set your PDO data source name (DSN) with the following configuration in your
/conf/config.php
file:Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
Thanks> @businessdad said:
Thanks for that, you're right. It turns out it was an issue with Allowed Network access. My host was giving me the wrong IP to whitelist. Thanks again.