Fix for Drupal "Warning: Table 'yourdrupaldb.cache_page' doesn't exist query" - How I Did It
If you are an advanced Drupal6 User or a Drupal Admin like me (and especially if you use some of the MySQL Replication Best Practices for Drupal), you may run into this error in your logs:
Well, for some reason a table needed for Drupal caching is missing. The table name is "cache_page". The additional errors are all results of this table being missing and its impact on other parts of the code.
This is just one of quite a few tables related to caching that sometimes come up missing. The reason you might see this using the MySQL Replication technique I described in my other post is because we do not replicate the cache for performance reasons and therefore that table may not exist when you create secondary replicas from your first master.
Here is the Drupal 6 fix for this missing table from the Drupal Installer code:
-
Warning: Table 'yourdrupaldb.cache_page' doesn't exist query: SELECT data, created, headers, expire, serialized FROM cache_page
-
Warning: Cannot modify header information - headers already sent by (output started at /var/www/yourdrupalsitefolder/includes/database.mysql.inc:128) in /var/www/yourdrupalsitefolder/includes/bootstrap.inc on line 726
Warning: Cannot modify header information - headers already sent by (output started at /var/yourdrupalsitefolder/web/includes/database.mysql.inc:128) in /var/www/yourdrupalsitefolder/includes/bootstrap.inc on line 727
Warning: Cannot modify header information - headers already sent by (output started at /var/yourdrupalsitefolder/web/includes/database.mysql.inc:128) in /var/www/yourdrupalsitefolder/includes/bootstrap.inc on line 728
Warning: Cannot modify header information - headers already sent by (output started at /var/www/yourdrupalsitefolder/includes/database.mysql.inc:128) in /var/www/yourdrupalsitefolder/includes/bootstrap.inc on line 729
Well, for some reason a table needed for Drupal caching is missing. The table name is "cache_page". The additional errors are all results of this table being missing and its impact on other parts of the code.
This is just one of quite a few tables related to caching that sometimes come up missing. The reason you might see this using the MySQL Replication technique I described in my other post is because we do not replicate the cache for performance reasons and therefore that table may not exist when you create secondary replicas from your first master.
Here is the Drupal 6 fix for this missing table from the Drupal Installer code:
- Enter MySQL environment: mysql -umysqluser -p
- In MySQL environment: use drupaldb;
- Exit MySQL: quit;
(you will be prompted to type in your MySQL password for user "mysqluser")
CREATE TABLE `cache_page` ( `cid` varchar(255) NOT NULL default '', `data` longblob, `expire` int(11) NOT NULL default '0', `created` int(11) NOT NULL default '0', `headers` text, `serialized` smallint(6) NOT NULL default '0', PRIMARY KEY (`cid`), KEY `expire` (`expire`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8;
- from the (Linux) commandline: mysql -umysqluser -pmysqlpassword --execute="CREATE TABLE drupaldb.cache_page ( cid VARCHAR(255) NOT NULL DEFAULT '', data LONGBLOB DEFAULT NULL, expire INT NOT NULL DEFAULT 0, created INT NOT NULL DEFAULT 0, headers TEXT DEFAULT NULL, serialized SMALLINT NOT NULL DEFAULT 0, PRIMARY KEY (cid), INDEX expire (expire) ) DEFAULT CHARACTER SET UTF8;"
-
drupaldb = your Drupal database name
mysqluser = your MySQL User name
mysqlpassword = Your MySQL password
- Go to: http://www.yourdrupalsite.com/admin/settings/performance
- Click on: "Clear cached data" button
- Check your logs (http://www.yourdrupalsite.com/admin/reports/dblog) for any other errors
