Friday, February 12, 2016

[google-cloud-sql-discuss] Error establishing a database connection when install wordpress on app engine

Hi

I have this issue when I tried to install wordpress to app engine Yesterday (2/11/2016)
And, everything local works well, and I can even deploy successfully, however, when I tried to install wordpress on app engine by
I get an error page saying 
"

Error establishing a database connection

This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at :/cloudsql/<project_id>:testsqlv1. This could mean your host's database server is down.

.....

    "
    where, testsqlv1 is my CloudSQL instance id. I tried 'wordpress' as the instruction says, not work either.

    if I try http://<project_id>.appspot.com, I get page showing:

    "

    Error establishing a database connection

    "

    I first tried second gen, and then first gen, none works for me.

    I have app.yaml modified with <project_id> at the first line of the file
    like this:

    application: myprojectid
    version: wpfromstarterproject
    runtime: php55
    api_version: 1
    ...

    my wp-config.php is like this:
    ...

    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define('DB_NAME', 'wp_wordpress');


    // since my Cloud SQL instance id is "wordpress", so instance is: is wordpress here !
    if(isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
      define('DB_HOST', ':/cloudsql/myprojectid:testsqlv1');
      /** MySQL database username */
    define('DB_USER', 'root');

    /** MySQL database password */
    define('DB_PASSWORD', '');

    }else{
      define('DB_HOST', 'localhost');
    /** MySQL database username */
    define('DB_USER', 'myusername');

    /** MySQL database password */
    define('DB_PASSWORD', 'mypassword');
    ...
    and I have create wp_wordpress through mysql client and instance ip


    Can anyone help me on this issue?

    Thanks a lot in advance

    Hai

    --
    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/0443984c-363a-4189-9074-e7f623597fe2%40googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

    No comments:

    Post a Comment