Categories: Blog

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?

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.

Peter Tran

View Comments

  • Why did you not change the time limit in your script (or php.ini)?

    set_time_limit(0);
    ini_set('max_execution_time', 0);

    • You are correct. The command you mentioned will do the trick.

      My host had limitations of altering the max_execution_time at the time of writing.

Share
Published by
Peter Tran

Recent Posts

Kubernetes Resources to Learn From

I have been fortunate in working a lot more with Kubernetes lately over the last few months so I've been…

1 year ago

WordPress Development using Docker

Building my portfolio site, I thought I'd show you how I set up my Wordpress development using Docker. Given the…

1 year ago

Blank images in Puppeteer screenshots solved!

Frustrated with getting blank images in Puppeteer Chrome screenshots, recently I was in a situation where I needed to migrate…

1 year ago

Plans Moving Forward – The Revamped Web and I

It has been six year since my last major revamp/redesign of my current petertran.com.au portfolio site. So what are my…

1 year ago

Bad owner or permissions on .ssh/config

This article helps to solve a Bad owner or permissions on .ssh/config issue occurring on a Windows 10 machine when…

1 year ago

Accept payments easily and effortlessly with Pin Payments integration

Only a few lines of code required is to implement a payment system, thanks to inline Pin Payments integration. Accepting…

6 years ago