P. Tran.

MySQL Maximum execution time of 300 seconds exceeded in command line – tips

Have you been working with large MySQL databases? Have you just performed a database export to a file from a web interface such as phpMyAdmin and attempted to import it elsewhere via a command line similar to the below?

Have you been working with large MySQL databases? Have you just performed a database export to a file from a web interface such as phpMyAdmin and attempted to import it elsewhere via a command line similar to the below?

mysql -u USER -p DBNAME < dump.sql

I came across the following issue where I kept getting this error message:

Fatal error: Maximum execution time of 300 seconds exceeded in /usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries/dbi/mysql.dbi.lib.php on line 229

The reason for this is due to the source’s PHP export script timing out from its max_execution_time setting.

To resolve this, either use a command line to perform the export or if you have SSH access on your server or split the export into several stages. I’ve had to split my export into two lots to get the timeout under 300 seconds which was the shared cPanel server’s max limit.