Views: 28403
Last Modified: 09.07.2021
When a database query error occurs, the following error message is displayed:
![](/images/portal_admin/install/additional/db_query_error.png)
The visual aspect of the message is defined by the contents of the file /bitrix/php_interface/dbquery_error.php.
Situations may happen when a site denies to reply and returns an empty page to visitors. In this case, open the file bitrix/php_interface/dbconn.php containing the database connection parameters, and set the parameter: $DBDebug = true;
<?
define("DBPersistent", true);
$DBType = "mysql";
$DBHost = "localhost:31006";
$DBLogin = "root";
$DBPassword = "";
$DBName = "bsm_demo";
$DBDebug = true;
$DBDebugToFile = false;
set_time_limit(60);
define("BX_FILE_PERMISSIONS", 0644);
define("BX_DIR_PERMISSIONS", 0755);
@ini_set("memory_limit", "64M");
?>
This will cause the error message to be printed. The message usually contains names of damaged tables.
![](/images/portal_admin/install/additional/db_query_error_ext.png)
Run perror.exe (can be found in mysql/bin) with the error code to get the error description:
![](/images/portal_admin/install/additional/error_code.png)
Note:
The error
28 displays the following description:
![](/images/portal_admin/install/additional/error_code_examp.png)
This means that the disk on which the database is installed is out of free space.
If the database damage is the case, you are recommended to use the built-in database check and repair tool. This will allow you to restore the site functionality in the shortest possible time.
Note!
- The standard database check and repair tool only works with the MyISAM tables of MySQL.
- The check script starts from the administrative section of the site Settings > Tools > System Administration > Database Check:
![](/images/install_en/db_check1.png)
![](/images/install_en/db_check2.png)
If the statistics tables are damaged and you cannot open the Control Panel, you can disable gathering statistics by supplying the parameter ?no_keep_statistic_LICENSE-KEY=Y
on the URL (substitute LICENSE-KEY
with your license key).
-
There is a possibility to use the check script and recover the database without the need to go to the administrative section.
To do so, supply the database access login and password on the URL. For example: http://www.mysite.com/bitrix/admin/repair_db.php?login=DB_Login&password=DB_Password. By default, the database access parameters are stored in /bitrix/php_interface/dbconn.php.
Problem:
The following error appears on the screen:
MySQL Query Error: ….. [Out of memory restart server and try again (needed 65528 bytes)] |
|
Solution:
Memory size must be increased in MySQL settings.
The following MySQL parameters should be used and entered in the MySQL configuration file my.cnf:
key_buffer = 128K
max_allowed_packet = 16M
table_cache = 4
sort_buffer_size = 128K
read_buffer_size = 128K
read_rnd_buffer_size = 128K
net_buffer_length = 128K
thread_stack = 128K
MySQL will have to be reloaded after you change the parameters.