Title: Settings HyperDB on MultiSite for Multiple databases
Last modified: May 19, 2018

---

# Settings HyperDB on MultiSite for Multiple databases

 *  [gossamerzzz](https://wordpress.org/support/users/gossamerzzz/)
 * (@gossamerzzz)
 * [8 years ago](https://wordpress.org/support/topic/settings-hyperdb-on-multisite-for-multiple-databases/)
 * Hello! I want to make a multisite with multi database support from several stores.
   At the moment I’m doing everything on the local server.
    In file **wp-config.
   php**, created path **define(‘DB_CONFIG_FILE’, ‘C:\ProgramData\…..\xdiscounts.
   ru\db-config.php’);**. Put file **db-config.php** in folder **xdiscounts.ru\db-
   config.php**, file **db.php** in in folder **xdiscounts.ru\wp-content**. In the
   file **db-config.php** made the following settings:
 *     ```
       $wpdb->add_database(array(
       	'host'     => DB_HOST,     // If port is other than 3306, use host:port.
       	'user'     => DB_USER,
       	'password' => DB_PASSWORD,
       	'name'     => DB_NAME,
       	));
   
       $wpdb->add_database(array(
       	'host'     => DB_HOST,     // If port is other than 3306, use host:port.
       	'user'     => DB_USER,
       	'password' => DB_PASSWORD,
       	'name'     => DB_NAME2,
       	'write'    => 1,
       	'read'     => 1,
       	'dataset'  => 'wp_4',
       	'timeout'  => 0.2, 
       ```
   
 * In file **wp-config.php**, created path **define(‘DB_NAME2’, ‘xdiscounts111’);**
   
   In the second database(xdiscounts111), I created tables:
 *     ```
       wp_4_commentmeta
       wp_4_comments
       wp_4_links
       wp_4_options
       wp_4_postmeta
       wp_4_posts
       wp_4_termmeta
       wp_4_terms
       wp_4_term_relationships
       wp_4_term_taxonomy
       wp_4_woocommerce_api_manager_secure_hash
       ```
   
 * But when I start creating a product, it is created only in the first database,
   and the second database(xdiscounts111) remains empty.
    What am I doing wrong!?
   My **PHP Version 7.2.2** and **MySQL Server 5.6**. Thank you in advance!!!
    -  This topic was modified 8 years ago by [gossamerzzz](https://wordpress.org/support/users/gossamerzzz/).
    -  This topic was modified 8 years ago by [gossamerzzz](https://wordpress.org/support/users/gossamerzzz/).
    -  This topic was modified 8 years ago by [gossamerzzz](https://wordpress.org/support/users/gossamerzzz/).

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

 *  Thread Starter [gossamerzzz](https://wordpress.org/support/users/gossamerzzz/)
 * (@gossamerzzz)
 * [8 years ago](https://wordpress.org/support/topic/settings-hyperdb-on-multisite-for-multiple-databases/#post-10356608)
 * All figured out it was necessary to write a ‘global’ instead of ‘wp_4’. I initially
   thought that I need to write a table prefix ‘wp_4’. What is this parameter for‘
   dataset’? In what cases does it change?
    Thank you in advance…
 *  Thread Starter [gossamerzzz](https://wordpress.org/support/users/gossamerzzz/)
 * (@gossamerzzz)
 * [8 years ago](https://wordpress.org/support/topic/settings-hyperdb-on-multisite-for-multiple-databases/#post-10356673)
 * Perhaps this is necessary when you take information from another server and the
   data comes from another database on that server. And at this point you need to
   specify the name of this database !?

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

The topic ‘Settings HyperDB on MultiSite for Multiple databases’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/hyperdb_33353d.svg)
 * [HyperDB](https://wordpress.org/plugins/hyperdb/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hyperdb/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hyperdb/)
 * [Active Topics](https://wordpress.org/support/plugin/hyperdb/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hyperdb/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hyperdb/reviews/)

## Tags

 * [multisite](https://wordpress.org/support/topic-tag/multisite/)

 * 2 replies
 * 1 participant
 * Last reply from: [gossamerzzz](https://wordpress.org/support/users/gossamerzzz/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/settings-hyperdb-on-multisite-for-multiple-databases/#post-10356673)
 * Status: not resolved