Recently, one of our customers came across the PHPMyAdmin import database timeout error while importing SQL files into PHPMyAdmin.
It takes a long time and displays the timeout error.
As part of our Server Management Services, we assist our customers with several PHP queries.
Today, let us see how we can resolve this error.
PHPMyAdmin import database timeout
This error can occur if the database size is too large or the network connection is too slow.
PHPMyAdmin does not rely on the timeout or memory limit set in cPanel. It takes its values from the server default timeout specified in WHM.
1. If we have shell access, we log in to the user account as the cPanel user and run:
# mysql -u username -p
In the prompt we enter the password then run the command:
mysql> use database_name;
Then we import the database:
mysql database_name < /our/path/to/backup.sql;
Our Support Techs recommend this method if the database size is large.
If in case there is no shell access, we have to contact the hosting provider with the backup file.
2. If the import is to be done via cPanel provided PHPMyAdmin itself, then we need to increase the timeout.
To do so, go to, WHM >> Tweak Settings >> cPanel PHP max execution time.
3. Another option is to import the backup as chunks but it is more complex.
4. To increase the phpMyAdmin Session Timeout, open config.inc.php in the root phpMyAdmin directory and add:
$cfg[‘LoginCookieValidity’] = <your_new_timeout>;
Here, the your_new_timeout is a number larger than 1800.
5. If we use WAMP, then there is a file in <our-wamp-dir>\alias\phpmyadmin.conf which overrides a few php.ini options.
# To import big file we can increase values php_admin_value upload_max_filesize 512M php_admin_value post_max_size 512M php_admin_value max_execution_time 600 php_admin_value max_input_time 600
6. In cPanel/WHM, the location of file config.default.php is under /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries.
But if we use Plesk, change the settings in /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php.
We change $cfg[‘ExecTimeLimit’] = 300; to $cfg[‘ExecTimeLimit’] = 0;
Then we restart apache and mysql services.
We can restart with Plesk UI or use:
/etc/init.d/psa restart and /etc/init.d/httpd restart
7. Starting from Plesk 12.5, we can import databases via Plesk.
To do so, browse to Home > Domains > example.com > Databases and use importing functionality.
[Couldn’t fix the error? We are here for you]
In short, today we saw how our Support Techs resolve the PHPMyAdmin import database timeout error.