• 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 6 years, 6 months ago by gossamerzzz.
    • This topic was modified 6 years, 6 months ago by gossamerzzz.
    • This topic was modified 6 years, 6 months ago by gossamerzzz.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter gossamerzzz

    (@gossamerzzz)

    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

    (@gossamerzzz)

    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.