Fli
02-16-2022, 06:37 PM
After moving the IPB (InvisionPowerBoard) forum to other server or migrating to new MySQL or MariaDB, one can face following error when accessing admin area:
Driver Error
There appears to be an error with the database.
If you are seeing this page, it means there was a problem communicating with our database. Sometimes this error is temporary and will go away when you refresh the page. Sometimes the error will need to be fixed by an administrator before the site will become accessible again.
You can try to refresh the page by clicking here
One can check file /cache/sql_error_latest.cgi for the issue details. It may show the error of this kind:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'rows FROM ips_sessions WHERE running_time > 1644781837' at line 1
IP Address: MYIP - /admin/index.php?adsess=abcd
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mySQL query error: SELECT count(*) as rows FROM ips_sessions WHERE running_time > 1644781837
.--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
| File | Function | Line No. |
|----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
| admin/sources/base/ipsController.php | [admin_core_mycp_dashboard].doExecute | 306 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
but the actual cause of the problem in my case was different file. This is what fixed the issue:
searching all the files for "as rows" and only file found was /admin/applications/core/modules_admin/mycp/dashboard.php
containing 1 occurrence here:
$online = $this->DB->buildAndFetch( array( 'select' => 'count(*) as rows', 'from' => 'sessions', 'where' => "running_time > {$time}" ) );
Replacing "as rows" by "as rowss", saving the file and reloading admin area page caused admin area accessible.
Same error appears after submitting registration form, with file /cache/sql_error_latest.cgi showing:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Date: Thu, 17 Feb 2022 09:21:53 +0000
Error: 1364 - Field 'sfsMemInfo' doesn't have a default value
IP Address: MYIP - /index.php?app=core&module=global§ion=register
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mySQL query error: INSERT INTO ips_pfields_content (`member_id`) VALUES(335)
.--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
| File | Function | Line No. |
|----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
| admin/sources/base/ipsMember.php | [db_main_mysql].insert | 706 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| admin/applications/core/modules_public/global/register.php | [IPSMember].create | 1908 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| hooks/stopForumSpam_*.php | [public_core_global_register].registerProcessForm | 74 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| admin/applications/core/modules_public/global/register.php | [stopForumSpam].registerProcessForm | 65 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| admin/sources/base/ipsController.php | [public_core_global_register].doExecute | 306 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
solution was to open MySQL browser (PHPMyAdmin), select database, click SQL tab and run:
ALTER TABLE ips_pfields_content ALTER COLUMN sfsMemInfo SET Default 0;ALTER TABLE ips_pfields_content ALTER COLUMN sfsNextCheck SET Default 0;
(replace ips_ by your actual table prefix)
Or manually:
Click database, click Structure link next to table ips_pfields_content, and edit sfsMemInfo + sfsNextCheck to have default value not None, but 0.
Driver Error
There appears to be an error with the database.
If you are seeing this page, it means there was a problem communicating with our database. Sometimes this error is temporary and will go away when you refresh the page. Sometimes the error will need to be fixed by an administrator before the site will become accessible again.
You can try to refresh the page by clicking here
One can check file /cache/sql_error_latest.cgi for the issue details. It may show the error of this kind:
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'rows FROM ips_sessions WHERE running_time > 1644781837' at line 1
IP Address: MYIP - /admin/index.php?adsess=abcd
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mySQL query error: SELECT count(*) as rows FROM ips_sessions WHERE running_time > 1644781837
.--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
| File | Function | Line No. |
|----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
| admin/sources/base/ipsController.php | [admin_core_mycp_dashboard].doExecute | 306 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
but the actual cause of the problem in my case was different file. This is what fixed the issue:
searching all the files for "as rows" and only file found was /admin/applications/core/modules_admin/mycp/dashboard.php
containing 1 occurrence here:
$online = $this->DB->buildAndFetch( array( 'select' => 'count(*) as rows', 'from' => 'sessions', 'where' => "running_time > {$time}" ) );
Replacing "as rows" by "as rowss", saving the file and reloading admin area page caused admin area accessible.
Same error appears after submitting registration form, with file /cache/sql_error_latest.cgi showing:
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Date: Thu, 17 Feb 2022 09:21:53 +0000
Error: 1364 - Field 'sfsMemInfo' doesn't have a default value
IP Address: MYIP - /index.php?app=core&module=global§ion=register
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
mySQL query error: INSERT INTO ips_pfields_content (`member_id`) VALUES(335)
.--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
| File | Function | Line No. |
|----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------|
| admin/sources/base/ipsMember.php | [db_main_mysql].insert | 706 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| admin/applications/core/modules_public/global/register.php | [IPSMember].create | 1908 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| hooks/stopForumSpam_*.php | [public_core_global_register].registerProcessForm | 74 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| admin/applications/core/modules_public/global/register.php | [stopForumSpam].registerProcessForm | 65 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
| admin/sources/base/ipsController.php | [public_core_global_register].doExecute | 306 |
'----------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------------'
solution was to open MySQL browser (PHPMyAdmin), select database, click SQL tab and run:
ALTER TABLE ips_pfields_content ALTER COLUMN sfsMemInfo SET Default 0;ALTER TABLE ips_pfields_content ALTER COLUMN sfsNextCheck SET Default 0;
(replace ips_ by your actual table prefix)
Or manually:
Click database, click Structure link next to table ips_pfields_content, and edit sfsMemInfo + sfsNextCheck to have default value not None, but 0.