title: Database errors when running Wordpress on Google App Engine
body: <p>I'm trying to run Wordpress on my PHP runtime whitelisted Google App Engine application. I created a module named "wordpress" and installed Wordpress 3.6.1 (in Dutch) as per the instructions found in <a href="https://developers.google.com/appengine/articles/wordpress" rel="nofollow">this article</a>. (Update: I tried Wordpress 2.5.1 English, 2.6 Dutch and 2.6.1 Dutch. I got the same error messages with all versions.)</p>
  
  <p>It worked without a problem in my local development environment but not in production on Google App Engine. When I go to <code>http://www.mydomain.com/wordpress/</code>, it redirects to <code>http://www.mydomain.com/wordpress/wp-admin/install.php</code>. In the App Engine logs of the Wordpress module I get these messages ("databasefout" means "database error"):</p>
  
  <pre><code>E 2013-10-02 09:23:33.030
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'siteurl' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), wp_plugin_directory_constants, get_option
  ...
  E 2013-10-02 09:23:33.506
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'cron' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_next_scheduled, _get_cron_array, get_option
  E 2013-10-02 09:23:33.511
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('cron', 'a:2:{i:1380698613;a:1:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option, add_option
  E 2013-10-02 09:23:33.513
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query UPDATE `wp_options` SET `option_value` = 'a:2:{i:1380698613;a:2:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}' WHERE `option_name` = 'cron' gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option
  E 2013-10-02 09:23:33.515
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query UPDATE `wp_options` SET `option_value` = 'a:2:{i:1380698613;a:3:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:17:\"wp_update_plugins\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}s:16:\"wp_update_themes\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}' WHERE `option_name` = 'cron' gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option
  E 2013-10-02 09:23:33.516
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'theme_switched' LIMIT 1 gemaakt door require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, check_theme_switched, get_option
  E 2013-10-02 09:23:33.518
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'rewrite_rules' LIMIT 1 gemaakt door require('wp-blog-header.php'), wp, WP-&gt;main, WP-&gt;parse_request, WP_Rewrite-&gt;wp_rewrite_rules, get_option
  ...
  E 2013-10-02 09:23:33.530
  WordPress databasefout Table 'wordpress_db.wp_options' doesn't exist bij query SELECT option_value FROM wp_options WHERE option_name = 'sticky_posts' LIMIT 1 gemaakt door require('wp-blog-header.php'), wp, WP-&gt;main, WP-&gt;query_posts, WP_Query-&gt;query, WP_Query-&gt;get_posts, get_option
  </code></pre>
  
  <p>My database <code>wordpress_db</code> on my Google Cloud SQL instance is still empty (no tables). My MySQL user has the following privileges:</p>
  
  <pre><code>GRANTEE
  TABLE_CATALOG
  TABLE_SCHEMA
  PRIVILEGE_TYPE
  IS_GRANTABLE
  'wp_user'@'localhost'
  def
  wordpress_db
  SELECT
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  INSERT
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  UPDATE
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  DELETE
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  CREATE
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  DROP
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  REFERENCES
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  INDEX
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  ALTER
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  CREATE TEMPORARY TABLES
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  LOCK TABLES
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  EXECUTE
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  CREATE VIEW
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  SHOW VIEW
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  CREATE ROUTINE
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  ALTER ROUTINE
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  EVENT
  NO
  'wp_user'@'localhost'
  def
  wordpress_db
  TRIGGER
  NO
  </code></pre>
  
  <p>What could be the problem? It seems to me Wordpress is trying to access the table <code>wordpress_db.wp_options</code> before creating it.</p>
  
  <p>Update: if I create the database tables manually on the Google Cloud SQL instance, and then go to <code>http://www.mydomain.com/wordpress/</code> I get the message:</p>
  
  <blockquote>
    <p>wordpress error establishing a database connection</p>
  </blockquote>