Reputation: 1919
I have been trying to import Database through phpMyAdmin. My database file is a.sql
and it's size is 1.2 GB
I am trying to import this on local and phpMyAdmin is saying:
You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.
Please help I really need this to work.
Upvotes: 90
Views: 382825
Reputation:
Use command line:
mysql.exe -u USERNAME -pPASSWORD DATABASENAME < MYDATABASE.sql
where MYDATABASE.sql
is your SQL file.
Upvotes: 22
Reputation: 1563
For ubuntu 14.04 use this:
Open php.ini
using gedit or nano:
sudo gedit /etc/php5/apache2/php.ini
Find upload_max_size
then replace this single line with these lines:
max_execution_time = 259200
max_input_time = 259200
memory_limit = 1000M
upload_max_filesize = 750M
post_max_size = 750M
Save php.ini
and close editor
Restart apache2:
sudo service apache2 restart
Now open localhost://phpmyadmin/
in browser and upload your database.sql
Upvotes: 6
Reputation: 92
Just to put this here as I just updated my databases in xampp after several tries and reading the answers here. I used the Xampp 7.4
I tried to edit the ExecTimeLimit
variable in config.default.php but still kept timing out and finally when I looked at the code I realized that if you put it to 0 it ill still default to 300. So you need to put it to actual high value to have a longer timeout.
/**
* @param array<int|string, mixed> $settings
*
* @psalm-return 0|positive-int
*/
private function setExecTimeLimit(array $settings): int
{
if (! isset($settings['ExecTimeLimit'])) {
return 300;
}
$execTimeLimit = (int) $settings['ExecTimeLimit'];
return $execTimeLimit >= 0 ? $execTimeLimit : 300;
}
Upvotes: 0
Reputation: 11
If you do not want to change the settings or play with command line. There is option to compress the file and upload in phpMyAdmin. It should bring down the size considerably.
Upvotes: 0
Reputation: 501
If you are using MySQL in Xampp then do the steps below.
Find the following in XAMPP control panel>Apach-Config> PHP (php.ini) file
post_max_size = 8M
upload_max_filesize = 2M
enter code here
memory_limit = 8MAnd change their sizes according to your need. I'm using these values
post_max_size = 30M
upload_max_filesize = 30M
max_execution_time = 4500
max_input_time = 4500
memory_limit = 850M
Upvotes: 7
Reputation: 527
to import big database into phpmyadmin there are two ways 1 increase file execution size from php.ini 2 use command line to import big database.
Upvotes: 1
Reputation: 1917
For Upload large size data in using phpmyadmin Do following steps.
max_execution_time = 259200
max_input_time = 259200
memory_limit = 1000M
upload_max_filesize = 750M
post_max_size = 750M
than after restart wamp server or restart all services Now Upload
data using import function in phymyadmin. Apply second step if
till not upload data.$cfg['ExecTimeLimit'] = 300;
Replace to $cfg['ExecTimeLimit'] = 0;
You can also upload large size database using MySQL Console as below.
root
in popupUSE DATABASENAME
SOURCE C:\FOLDER\database.sql
Note: You can't load a compressed database file e.g. database.sql.zip
or database.sql.gz
, you have to extract it first. Otherwise the console will just crash.
Upvotes: 108
Reputation: 111
Set the below values in php.ini
file (C:\xampp\php\
)
max_execution_time = 0
max_input_time=259200
memory_limit = 1000M
upload_max_filesize = 750M
post_max_size = 750M
Open config.default file(C:\xampp\phpMyAdmin\libraries\config.default) and set the value as below:
Then open the config.inc file(C:\xampp\phpMyAdmin\config.inc). and paste below line:
$cfg['UploadDir'] = 'upload';
Go to phpMyAdmin(C:\xampp\phpMyAdmin
) folder and create folder called upload
and paste your database to newly created upload folder (don't need to zip)
Lastly, go to phpMyAdmin and upload your db (Please select your database in drop-down)
*It takes lot of time.In my db(266mb) takes 50min to upload. So be patient ! *
Upvotes: 10
Reputation: 11
You can also try compressing (zipping) the file. It sometimes works for me if I can't get to php.ini for phpmyadmin. If zipping reduces the file size below the maximum file size, it just might work!
Upvotes: 1
Reputation: 38584
You no need to edit php.ini
or any thing.
I suggest best thing as Just use MySQL WorkBench.
JUST FOLLOW THE STEPS.
Install MySQL WorkBench 6.0
And In "Navigation panel"(Left side) there is option call 'Data import' under "MANAGEMENT". Click that and [follow steps below]
"dump"[simple]
.Upvotes: 1
Reputation: 1878
Here is what I've done:
C:\xampp\php
php.ini
using your text editor, preferably you can also you Notepad for Windows machine.upload_max_filesize = 128M
post_max_size = 128M
max_execution_time = 300
max_input_time = 60
Done!
Upvotes: 39
Reputation:
Its due to PHP that has a file size restriction for uploads.
If you have terminal/shell access then the above answers @Kyotoweb will work.
one way to get it done is that you create an .htaccess/ini file file to change PHP settings to get the sql file uploaded through PHPmyAdmin.
php_value upload_max_filesize 120M //file size
php_value post_max_size 120M
php_value max_execution_time 200
php_value max_input_time 200
Note you should remove this file after upload.
Upvotes: 80
Reputation: 23263
Another option that nobody here has mentioned yet is to do a staggered load of the database using a tool like BigDump to work around the limit. It's a simple PHP script that loads a chunk of the database at a time before restarting itself and moving on the the next chunk.
Upvotes: 4
Reputation: 39763
You have three options:
Upvotes: 0