Title: WordPress Multi DB missed table
Last modified: August 19, 2016

---

# WordPress Multi DB missed table

 *  Resolved [turkel](https://wordpress.org/support/users/turkel/)
 * (@turkel)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/wordpress-multi-db-missed-table/)
 * Hi,
 * I have upgraded my wordpress from 2.8 to 3.0 and now all new new blogs are creates
   without commentmeta database. I have 3500 blogs and i think on old wp (v2.8) 
   this table also not created and i have just noticed this from error logs.
    Is
   there are way to create this table for all blogs? I am working on script which
   will create this tables for all blogs but i can`t get luck as database is scaled
   to 16 DBs and while i run script it can`t find correct blog_ids on one db. Please,
   give me some suggestions.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [turkel](https://wordpress.org/support/users/turkel/)
 * (@turkel)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/wordpress-multi-db-missed-table/#post-1958659)
 * My script code is this:
 *     ```
       <?php
       error_reporting(E_ALL);
       $db_connect = mysql_connect("localhost","root","");
       if (!$db_connect) {
         die('Could not connect: ' . mysql_error());
       }
   
       mysql_select_db("wpmu_global", $db_connect);
       $sqlid = "SELECT * FROM wp_blogs";
       $result1 = mysql_query($sqlid) or die(mysql_error());
   
       while($row = mysql_fetch_array($result1)){
       	$blogid = array($row['blog_id']);
       	$data = $row['blog_id'];
       }
       mysql_close($db_connect);
   
       $db_connect = mysql_connect("localhost","root","");
       if (!$db_connect) {
         die('Could not connect: ' . mysql_error());
       }
   
       mysql_select_db("wpmu_1", $db_connect); //first db and i will run script for each db
   
       foreach ($blogid as &$data) {
       echo $sql = "CREATE TABLE IF NOT EXISTS <code>wp_&quot;.$data.&quot;_commentmetaTest</code> (
         <code>meta_id</code> bigint(20) unsigned NOT NULL AUTO_INCREMENT,
         <code>comment_id</code> bigint(20) unsigned NOT NULL DEFAULT '0',
         <code>meta_key</code> varchar(255) DEFAULT NULL,
         <code>meta_value</code> longtext,
         PRIMARY KEY (<code>meta_id</code>),
         KEY <code>comment_id</code> (<code>comment_id</code>),
         KEY <code>meta_key</code> (<code>meta_key</code>)
       ) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1";
       }
   
       $result = mysql_query($sql) or die(mysql_error());
   
       mysql_close($db_connect);
       ?>
       ```
   
 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/wordpress-multi-db-missed-table/#post-1958681)
 * if the multi db plugin skipped the extra tables, talk to the people you got the
   plugin from.
 *  Thread Starter [turkel](https://wordpress.org/support/users/turkel/)
 * (@turkel)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/wordpress-multi-db-missed-table/#post-1958709)
 * actually, Multi DB seems works because newly created blogs have required table.
   Problem is on old ones and that is why i have created this script for to create
   tables on DBs. This code not works because of Multi DB as i understand.
 *  [Andrea Rennick](https://wordpress.org/support/users/andrea_r/)
 * (@andrea_r)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/wordpress-multi-db-missed-table/#post-1958717)
 * Read this:
 * [http://ocaoimh.ie/wpmu-add-commentmeta/](http://ocaoimh.ie/wpmu-add-commentmeta/)
 * And go back to where you got the plugin from and ask them how they handled it
   with multi dbs.
 *  Thread Starter [turkel](https://wordpress.org/support/users/turkel/)
 * (@turkel)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/wordpress-multi-db-missed-table/#post-1958730)
 * ahh perfect that is what i am trying to create. They have created it as plugin
   which i have not thought that way lol.
 * Thank you very much Andrea_r 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘WordPress Multi DB missed table’ is closed to new replies.

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 5 replies
 * 2 participants
 * Last reply from: [turkel](https://wordpress.org/support/users/turkel/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/wordpress-multi-db-missed-table/#post-1958730)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
