XF 1.5 Mysqli prepare error: Unknown column 'user_id' in 'where clause'


I got a strange error when trying to login to the admin control panel today:

Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
Zend_Db_Adapter_Abstract->query() in Zend/Db/Adapter/Abstract.php at line 825
Zend_Db_Adapter_Abstract->fetchOne() in XenForo/Model/Admin.php at line 203
XenForo_Model_Admin->getAdminPermissionCacheForUser() in XenForo/Visitor.php at line 276
XenForo_Visitor->hasAdminPermission() in XenForo/Model/AdminNavigation.php at line 350
XenForo_Model_AdminNavigation->filterUnviewableAdminNavigation() in XenForo/Model/AdminNavigation.php at line 406
XenForo_Model_AdminNavigation->getAdminNavigationForDisplay() in XenForo/Dependencies/Admin.php at line 227
XenForo_Dependencies_Admin->_getNavigationContainerParams() in XenForo/Dependencies/Admin.php at line 205
XenForo_Dependencies_Admin->getEffectiveContainerParams() in XenForo/FrontController.php at line 637
XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
XenForo_FrontController->run() in /home/on3pointsadmin/public_html/admin.php at line 13

I had my host check the database error log. This is what they found:

2017-10-29 20:28:18 7f8fcaffd700 InnoDB: FTS Optimize Removing table ***db/#sql2-360-28ca
2017-10-29 20:37:37 7f8fcaffd700 InnoDB: FTS Optimize Removing table ***db/#sql2-360-2912

Luckily, I made a database backup on 10/27/2017 so I only lost a few days. The site is now working properly again since I restored the backup. However, I definitely don't want this to happen again.

Can anyone help me to figure out what happened?


XenForo developer
Staff member
Somehow an important and fundamental column got dropped from the xf_admin table. This isn't something that XF would do (nor would it be likely for an add-on to do it).

It's difficult to suggest what may have caused it. The only thing that seems likely is a server issue of some sort. Beyond that, someone getting access to your database, though that sounds reasonably unlikely as well.