How to import sql files that are larger than 10 MB in mysql database

I cannot import a sql file larger than 10 MB.

Can I import a file larger than 10 MB using MYSQL ?

EDIT:

I have a mysql dump file that is more than 10 MB. I cannot import it into my localhost. When I try, the following error occurs:

ERROR: You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit. 

Thanks in advance.

+6
mysql
source share
8 answers

You need to do this through the command line.

Since you wrote localhost above, I assume you have access. It also has no time limits for importing data.

 mysql -u username -p database < location/to/your/dump.sql 

-p will ask you for a password. If the user does not have a password, ignore the flag.


edit: @Marco Mariani: This is an option, but keep in mind that this limit will be used for ALL of your PHP applications on the same server. You can change it back after importing, but it is rather tedious, and high load level is not a good idea. IMO.

+13
source share

copy and paste below: The upper limit to limit download and post-limit in PHP copy and paste below: http://daipratt.co.uk/importing-large-files-into-mysql-with-phpmyadmin/

How I overcame the same problem.

When trying to import large SQL files into mysql using phpmyadmin, the phpmyadmin documentation offers several solutions, but I find the easiest way to overcome this ...

Locate the config.inc.php file located in the phpmyadmin directory. In my case, it is here :? 1 C:\wamp\apps\phpmyadmin3.2.0.1\config.inc.php

Find the line with $cfg['UploadDir'] on it and update it to :? 1 $cfg['UploadDir'] = 'upload';

Create a directory named 'upload in the phpmyadmin directory.? 1 C:\wamp\apps\phpmyadmin3.2.0.1\upload\

Then put the large sql file that you are trying to import into the new download directory. Now, when you go to the db import page in the phpmyadmin console, you will see a drop-down list that was not there before - it contains all the sql files in the download directory that you just created. Now you can select this and start importing.

If you are not using WAMP on Windows, then I am sure that you can easily adapt it to your environment without any problems.

+8
source share

To solve problems with loading you need to edit the php.ini file

edit / etc / php5 / apache2 / php.ini

change the upload file size, then you can load the maximum DB size:

upload_max_filesize = 999M

to change the data prefix: post_max_size = 99M

then run the command

sudo service apache2 restart

+3
source share

You can use SQLyog (obs: SQLYog community edition download link ) to import data into mysql. There is no limit of 10 MB (from php.ini using phpmyadmin)

+2
source share

If you use MySQL in Xampp , follow these steps.
Find in php.ini file

following:
 post_max_size = 8M upload_max_filesize = 2M max_execution_time = 30 max_input_time = 60 memory_limit = 8M 

And resize them to fit your needs. I use these values

 post_max_size = 30M upload_max_filesize = 30M max_execution_time = 4500 max_input_time = 4500 memory_limit = 850M 

Note: 1 upload_max_filesize essential But it is better to change everything.

Note: 2 You must restart the apache service.

+1
source share

This is because you are using php / phpmyadmin.

You can change the max_upload parameter in php.ini (or do it from the command line)

0
source share

If you want to import a file larger than 2 mb, try importing it in zip format. Make sure you name zip as filename.sql.zip, in case of other compressions, change the extension accordingly. I imported a 10 megabyte file (magento sample data), after compression it became 1.8 mb and booted.

0
source share

Try fixing the .sql file. Worked great for me.

0
source share

All Articles