Trouble Deploying WordPress Using GAE – Locally Runs Properly

I properly set up the Cloud SQL instance and wordpress runs properly locally.
When I try to run the following commands, where INSTANCE_IP is my IP address to my Cloud SQL instance I get an error in my syntax:

{PATH_TO_MYSQL_BIN}/mysql --host=INSTANCE_IP --user=root --password
create database wordpress_db;
exit;

Edit, Error Message:

Read More
{PATH_TO_MYSQL_BIN}/mysql --host=xxx.19x.2xx.xx --user=root --password       -> create database wordpress_db;                                            ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '{PATH_TO_MYSQL_BIN}/mysql --host=173.194.243.33 --user=root --password create da' at line 1

If anyone could tell me what is wrong with my syntax that would be great, thanks in advance.
The following is the wp-config.php I believe is relevant:

// Required for batcache use
    define('WP_CACHE', true);

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

    /** MySQL database username */
    define('DB_USER', 'root');

    if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
        /** Live environment Cloud SQL login and SITE_URL info */
        define('DB_HOST', ':/cloudsql/your-project-id:wordpress');
        define('DB_USER', 'root');
        define('DB_PASSWORD', '');
    } else {
        /** Local environment MySQL login info */
        define('DB_HOST', '127.0.0.1');
        define('DB_USER', 'root');
        define('DB_PASSWORD', 'password');
    }

    // Determine HTTP or HTTPS, then set WP_SITEURL and WP_HOME
    if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443)
    {
        $protocol_to_use = 'https://';
    } else {
        $protocol_to_use = 'http://';
    }
    define( 'WP_SITEURL', $protocol_to_use . $_SERVER['HTTP_HOST']);
    define( 'WP_HOME', $protocol_to_use . $_SERVER['HTTP_HOST']);

    /** 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', '');

Related posts

Leave a Reply

1 comment

  1. looks like you’re following a guide from the Google cloud project site.

    Here’s some solutions:

    • First, if you have altered the user name or password during mysql install, make sure you update that in the config.php for wordpress.
    • Here’s the thing – in MySQL, if you are using the Workbench then all you need to run is:

      create database wordpress_db;

    As the other script was if you’re running it from cmd tool I believe.