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!!!
- The topic ‘Settings HyperDB on MultiSite for Multiple databases’ is closed to new replies.