WordPress database error Routing query to backend failed - urgent
Hallo wpForo team,
our server gives us following error:
WordPress database error Routing query to backend failed
It is in the get_post_url() function in class-posts.php.
This query is causing the trouble and returns wrong urls.
$sql = "SELECT tmp_view.`rownum` FROM
(SELECT @rownum := @rownum + 1 AS rownum, p.`postid`
FROM `" . WPF()->tables->posts . "` p
CROSS JOIN ( SELECT @rownum := 0 ) AS init_var
WHERE p.`topicid` = %d
" . $where . "
ORDER BY " . $orderby . ") AS tmp_view
WHERE tmp_view.`postid` = %d";
Please, help with this!
This usually comes from MariaDB Maxscale, do you use any of those?
If the rest of WP working right?
Also i see this from you:
It seems something bigger is going on.
There should not be such error. I think you've done some manipulation with the database or the data are wrong migrated from other database and forum software. Here are the steps you should check and do:
1. make sure there is no problem with forum database tables in Dashboard > Forums > Tools > Debug > Tables admin page.
2. Make sure your Database Server is up to date. It should be MySQL 5.6 / 5.7 or MariaDB 10.2 / 10.3 / 10.4.
3. make sure wpForo database tables use InnoDB Engine, use Hosting Service cPanel > phpMyAdmin tool to check. wpForo tables have wp_wpforo_ prefix.
4. Update wpForo data, go to Dashboard > Forums > Dashboard and click on following buttons with the same order:
- [Rebuild Threads]
- [Update Topic Statistic]
- [Update Forum Statistics]
- [Delete All Caches]