You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, All
have a issue where this plugin seems to not activate, i've checked logs it comes up as
[13-Aug-2024 23:51:37 UTC] WordPress database error Table 'db4z2otolssick.fjq_postmeta' doesn't exist for query SELECT
[13-Aug-2024 23:51:37 UTC] WordPress database error Table 'db4z2otolssick.fjq_posts' doesn't exist for query SELECT
So both them tables are located in different databases, I've attached the config file, as I can see what I'm doing wrong.
`<?php
/**
LudicrousDB configuration file
This file should be copied to ABSPATH/db-config.php and modified to suit your
database environment. This file comes with a basic configuration by default.
See README.md for documentation.
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
This sets the default character set. Since WordPress 4.2, the suggested
setting is "utf8mb4". We strongly recommend not downgrading to utf8,
using latin1, or sticking to the default: utf8mb4.
Default: utf8mb4
*/
$wpdb->charset = 'utf8mb4';
/**
This sets the default column collation. For best results, investigate which
collation is recommended for your specific character set.
This is the most basic way to add a server to LudicrousDB using only the
required parameters: host, user, password, name.
This adds the DB defined in wp-config.php as a read/write server for
the 'global' dataset. (Every table is in 'global' by default.)
*/
$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,
)
);
/**
This adds the same server again, only this time it is configured as a replica.
The last three parameters are set to the defaults but are shown for clarity.
*/
$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,
'write' => 1,
'read' => 1,
'dataset' => 'global',
'timeout' => 0.2,
)
);
// Custom callback for query routing
$wpdb->add_callback('db_callback');
function db_callback($query, $wpdb) {
if (strpos($query, $wpdb->base_prefix . 'fjq_posts') !== false) {
return 'fjq_posts';
}
if (strpos($query, $wpdb->base_prefix . 'fjq_postmeta') !== false) {
return 'fjq_postmeta';
}
return 'global';
}`
It seems to keep requesting the tables from the main database but it should be requesting it from the correct database. I think it must have to do with the callback, but not much info on how to correctly set it up.
Thanks
The text was updated successfully, but these errors were encountered:
Hi, All
have a issue where this plugin seems to not activate, i've checked logs it comes up as
[13-Aug-2024 23:51:37 UTC] WordPress database error Table 'db4z2otolssick.fjq_postmeta' doesn't exist for query SELECT
[13-Aug-2024 23:51:37 UTC] WordPress database error Table 'db4z2otolssick.fjq_posts' doesn't exist for query SELECT
So both them tables are located in different databases, I've attached the config file, as I can see what I'm doing wrong.
`<?php
/**
*/
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
*/
$wpdb->charset = 'utf8mb4';
/**
*/
$wpdb->collate = 'utf8mb4_unicode_520_ci';
/**
*/
$wpdb->save_queries = false;
/**
*/
$wpdb->recheck_timeout = 0.1;
/**
*/
$wpdb->persistent = false;
/**
*/
$wpdb->allow_bail = false;
/**
*/
$wpdb->max_connections = 10;
/**
*/
$wpdb->check_tcp_responsiveness = true;
/**
*/
$wpdb->cache_group = 'ludicrousdb';
/**
*/
$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_NAME,
'write' => 1,
'read' => 1,
'dataset' => 'global',
'timeout' => 0.2,
)
);
// Add the second database for handling
fjq_postmeta
table$wpdb->add_database(
array(
'host' => 'localhost',
'user' => 'ukwgyhvosujdc',
'password' => '32&$n#31cei1',
'name' => 'dbg6waxvouhikg',
'write' => 1,
'read' => 1,
'dataset' => 'fjq_postmeta',
)
);
// Add the third database for handling
fjq_posts
table$wpdb->add_database(
array(
'host' => 'localhost',
'user' => 'ukwgyhvosujdc',
'password' => '32&$n#31cei1',
'name' => 'dbnpicwhj2fcxq',
'write' => 1,
'read' => 1,
'dataset' => 'fjq_posts',
)
);
// Custom callback for query routing
$wpdb->add_callback('db_callback');
function db_callback($query, $wpdb) {
if (strpos($query, $wpdb->base_prefix . 'fjq_posts') !== false) {
return 'fjq_posts';
}
if (strpos($query, $wpdb->base_prefix . 'fjq_postmeta') !== false) {
return 'fjq_postmeta';
}
return 'global';
}`
It seems to keep requesting the tables from the main database but it should be requesting it from the correct database. I think it must have to do with the callback, but not much info on how to correctly set it up.
Thanks
The text was updated successfully, but these errors were encountered: