Importing large .sql file in phpMyAdmin in XAMPP takes time. Depending on how huge is your sql file size, the importing process can reach above the maximum execution time. When the maximum execution time limit is reached, it will stop the importing process and trigger the error message: Fatal error: Maximum execution time of 300 seconds exceeded
along with some information about the error's file and line location.
In XAMPP version 8.2.4-0, the complete error message that I got when trying to import a 21 MB .sql file was:
Fatal error: Maximum execution time of 300 seconds exceeded in C:\xampp\phpMyAdmin\libraries\classes\Dbal\DbiMysqli.php on line 209
The file size is not that large (only 21 MB), but the time required to import the sql file is apparently more than the default maximum execution time limit of 300 seconds or 5 minutes 😀 Later I found out that it took ±6 minutes 24 seconds to fully import a 21 MB .sql file.
Change the phpMyAdmin Configuration
The only way to fix the Fatal error: Maximum execution time of 300 seconds exceeded
issue is by increasing the time limit.
How to increase the maximum execution time in phpMyAdmin in XAMPP
We need to edit config.inc.php file to override the default value of maximum execution time that is set in phpMyAdmin default configuration file (C:\xampp\phpMyAdmin\libraries\config.default.php). These are the steps to reconfigure the maximum execution time:
- Open file config.inc.php in folder C:\xampp\phpMyAdmin.
- Add
$cfg['ExecTimeLimit'] = 3600;
to the end of the file, just before the comment section "End of servers configuration".The number 3600 means 3,600 seconds or 1 hour. You can change the number to maximum execution time you need in seconds.
- Save the change.
Now you can import large .sql files without interruptions anymore.
Note:
If you get similar error when running a PHP script (not when importing database in phpMyAdmin), check this solution to fix Fatal error: Maximum execution time of 120 seconds exceeded in XAMPP instead.