Fero
Fero

Reputation: 13315

How to import sql files which are more than 10mb in mysql database

I can't import a sql file that is more than 10 MB.

Is there any way to import a file that's more than 10MB using MYSQL?

EDIT:

I have a mysql dump file which is more than 10MB. I can't import it in 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.

Upvotes: 6

Views: 51153

Answers (8)

Ziv Rozenberg
Ziv Rozenberg

Reputation: 51

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

Upvotes: 0

Inzimam Tariq IT
Inzimam Tariq IT

Reputation: 6758

If you are using MySQL in Xampp then do the steps below.
Find the following in php.ini file

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

And 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

Note:1 upload_max_filesize is essential But it's better to change all.

Note:2 You must restart apache service.

Upvotes: 1

Vikas Jyoty
Vikas Jyoty

Reputation: 11

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

Upvotes: 0

errakeshpd
errakeshpd

Reputation: 2562

To resolve upload issues you need to edit the php.ini file

edit /etc/php5/apache2/php.ini

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

upload_max_filesize = 999M

to change post data limit : post_max_size = 99M

then execute the command

sudo service apache2 restart

Upvotes: 3

DrColossos
DrColossos

Reputation: 12998

You should to do it via the commandline.

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

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

-p will ask you for your password. If the user has no password, ignore the flag


edit: @Marco Mariani: This is a possibility, but keep in mind that this limit will be used for ALL of your PHP applications on the same server. You could change it back after the import but that's rather tedious and a high upload limit isn't a good idea IMO.

Upvotes: 14

laurent
laurent

Reputation: 908

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

Upvotes: 2

Jiar
Jiar

Reputation: 81

copy and pasted below from: Upper limit for Upload Limit and Post Limit in PHP copy and pasted below from: http://daipratt.co.uk/importing-large-files-into-mysql-with-phpmyadmin/

It's how i overcome the exact same issue.

When trying to import large SQL files into mysql using phpmyadmin, the phpmyadmin documentation offers a few solutions, but I find the easiest method to overcome this is…

Find the config.inc.php file located in the phpmyadmin directory. In my case it is located 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 called ‘upload’ within the phpmyadmin directory. ? 1 C:\wamp\apps\phpmyadmin3.2.0.1\upload\

Then place the large sql file that you are trying to import into the new upload directory. Now when you go onto the db import page within phpmyadmin console you will notice a drop down present that wasn’t there before – it contains all of the sql files in the upload directory that you have just created. You can now select this and begin the import.

If you’re not using WAMP on Windows, then I’m sure you’ll be able to adapt this to your environment without too much trouble.

Upvotes: 8

Marco Mariani
Marco Mariani

Reputation: 13776

This happens because you are using php/phpmyadmin.

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

Upvotes: 0

Related Questions