87

I want import huge (at least 300 mb) sql scripts via phpMyAdmin.

I've tried:

post_max_size = 750M
upload_max_filesize = 750M
max_execution_time = 300
max_input_time = 540
memory_limit = 1000M

in my php.ini file, but I'm still getting timeout errors during importing.

user1811486
  • 1,294
  • 2
  • 10
  • 17

11 Answers11

155

If even after repeated upload you still get timeout error, pleasechange your settings in

\phpmyadmin\libraries\config.default.php

from $cfg['ExecTimeLimit'] = 300; to $cfg['ExecTimeLimit'] = 0; and restart. Now there is no execution time limit (trust we are talking about local server).

Source : Change Script time out in phpmyadmin

jahajee.com
  • 3,683
  • 4
  • 21
  • 26
  • 37
    Or better still, put that setting in your `phpmyadmin/config.inc.php`. – bodo Mar 06 '15 at 20:32
  • I tried your suggestion, @canaaerus, but it messed my system even after I changed its place and finally undone it and restarted apache2 server. Now it says Error SQL query: DocumentationEdit Edit SELECT `comment` FROM `phpmyadmin`.`pma__column_info` WHERE db_name = 'bot4a' AND table_name = '' AND column_name = '(db_comment)' MySQL said: Documentation #1100 - Table 'pma__column_info' was not locked with LOCK TABLES – Rodrigo Jul 24 '15 at 13:18
  • 1
    @Rodrigo: I'm pretty sure this has nothing to do with the above setting. Also you should ask this a new question and not as a comment. – bodo Jul 27 '15 at 10:40
  • 2
    `config.inc.php` is at `/Library/Application Support/appsolute/MAMP PRO/phpMyAdmin` with MAMP on Mac OS X – Shaun Dychko Jul 30 '15 at 17:12
  • As @chuchunaku says - YOU SHOULD EDIT config.inc.php INSTEAD or it won't work. This is the settings it reverts to not active configuration. – Bysander Sep 23 '16 at 13:05
  • Thanks, this also solved mine I stuck in this for about 4 hours. – Muhammad Tarique Apr 10 '17 at 10:13
  • Another source : https://www.devside.net/wamp-server/apache-and-php-limits-and-timeouts – w3spi May 03 '17 at 10:06
  • If your visiting from 2018 on, I found this file in, /Applications/MAMP/bin/phpMyAdmin/ on my Mac. Just edit config.inc.php and thats it. – Dan Zuzevich Mar 07 '18 at 20:16
  • I am using AWS server, How can I solved this issue on AWS? – user9437856 Jul 12 '20 at 16:57
18

I'm using version 4.0.3 of MAMP along with phpmyadmin. The top of /Applications/MAMP/bin/phpMyAdmin/libraries/config.default.php reads:

DO NOT EDIT THIS FILE, EDIT config.inc.php INSTEAD !!!

Changing the following line in /Applications/MAMP/bin/phpMyAdmin/config.inc.php and restarting MAMP worked for me.

$cfg['ExecTimeLimit'] = 0;
chuchunaku
  • 181
  • 1
  • 3
  • Some of the other answers are saying to edit a file that says "DO NOT EDIT THIS FILE" why are people ignoring the notice? This answer gives solid advice and doesn't ignore the notice at the top of the file. – Spencer Shattuck Jul 18 '19 at 16:44
17

I had the same issue and I used command line in order to import the SQL file. This method has 3 advantages:

  1. It is a very easy way by running only 1 command line
  2. It runs way faster
  3. It does not have limitation

If you want to do this just follow this 3 steps:

  1. Navigate to this path (i use wamp):

    C:\wamp\bin\mysql\mysql5.6.17\bin>

  2. Copy your sql file inside this path (ex file.sql)

  3. Run this command:

    mysql -u username -p database_name < file.sql

Note: if you already have your msql enviroment variable path set, you don't need to move your file.sql in the bin directory and you should only navigate to the path of the file.

paulalexandru
  • 9,218
  • 7
  • 66
  • 94
12

But if you are using Plesk, change your settings in :

/usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php

Change $cfg['ExecTimeLimit'] = 300; to $cfg['ExecTimeLimit'] = 0;

And restart with Plesk UI or use:

/etc/init.d/psa restart and /etc/init.d/httpd restart

DanX
  • 234
  • 2
  • 7
9

If using Cpanel/WHM the location of file config.default.php is under

/usr/local/cpanel/base/3rdparty/phpMyAdmin/libraries

and you should change the $cfg['ExecTimeLimit'] = 300; to $cfg['ExecTimeLimit'] = 0;

Thibault
  • 1,566
  • 15
  • 22
user3057553
  • 91
  • 1
  • 2
5

If any of you happen to use WAMP then at least in the current version (3.0.6 x64) there's a file located in <your-wamp-dir>\alias\phpmyadmin.conf which overrides some of your php.ini options.

Edit this part:

# To import big file you 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

Artur K.
  • 3,263
  • 3
  • 38
  • 54
4

I was having the issue previously in XAMPP localhost with phpmyadmin version 4.2.11.

Increasing the timeout in php.ini didn't helped either.

Then I edited xampp\phpMyAdmin\libraries\config.default.php to change the value of $cfg['ExecTimeLimit'], which was 300 by default.

That solved my issue.

MarmiK
  • 5,639
  • 6
  • 40
  • 49
Supratim Roy
  • 842
  • 11
  • 16
2

None of the above answers solved it for me.

I cant even find the 'libraries' folder in my xampp - ubuntu also.

So, I simply restarted using the following commands:

sudo service apache2 restart

and

sudo service mysql restart
  • Just restarted apache and mysql. Logged in phpmyadmin again and it worked as usual.

Thanks me..!!

Deepak Keynes
  • 311
  • 2
  • 16
  • 1
    I guess restart or reload the service are just a normal step when editing configuration file. If phpmyadmin was in timeout, there was cleary another problem that should be troobleshoot before restart all web server directly – Jérémie Leclercq Mar 29 '22 at 14:52
0

I had this issue too and tried different memory expansion techniques I found on the web but had more troubles with it. I resolved to using the MySQL console source command, and of course you don't have to worry about phpMyAdmin or PHP maximum execution time and limits.

Syntax: source c:\path\to\dump_file.sql

Note: It's better to specify an absolute path to the dump file since the mysql working directory might not be known.

Victor Anuebunwa
  • 2,553
  • 2
  • 24
  • 34
0

go to /phpMyAdmin/libraries/config.default.php

Line Number 719

Change

$cfg['ExecTimeLimit'] = 300; 

to

$cfg['ExecTimeLimit'] = 0;
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 1
    This is not a good idea to set it to zero, better to increase the limit as needed without removing the limit – Lk77 Apr 28 '22 at 14:48
-2

To increase the phpMyAdmin Session Timeout, open config.inc.php in the root phpMyAdmin directory and add this setting (anywhere).

$cfg['LoginCookieValidity'] = <your_new_timeout>;

Where is some number larger than 1800.

Note:

Always keep on mind that a short cookie lifetime is all well and good for the development server. So do not do this on your production server.

Reference

Community
  • 1
  • 1
josef
  • 872
  • 9
  • 8