0

I have a 28 MB sql file need to import to mysql. Firstly, i'm using xampp to import, and it fails, and so i change my max_file_uploads, post_size(something like that)in php.ini-development and php.ini-product to 40 MB, but it still show "max:2048kb" and import fail again.

From research, i've learned to import by using mysql.exe, so i open mysql.exe and type the command line(msdos) below:

-u root -p dbname < C:\xxx\xxx\sqlfile.sql

but still failed again and again.....

what the problem is? xampp? or my sql setting?

6
  • Did you restarted your xampp after making changes to ini file? Commented Aug 14, 2013 at 10:52
  • 1
    can you please past the error message you get when the import fails? Commented Aug 14, 2013 at 10:53
  • Mr.Alien - yes Gnagno - this is when import sql.zip -"No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration." this is when impoty .sql - "You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit." Commented Aug 14, 2013 at 10:57
  • This reference link can help you stackoverflow.com/questions/9981098/… stackoverflow.com/questions/8062496/… Commented Aug 14, 2013 at 11:02
  • What does it say when you try to import it from the command line?. The message errors you mention sound like php / phpmyadmin to me. Commented Aug 14, 2013 at 12:18

6 Answers 6

3

Try this:

mysql -uroot -p --max_allowed_packet=24M dbname

Once you log into the database:

source C:\xxx\xxx\sqlfile.sql

I think that you should be able to load your file

Sign up to request clarification or add additional context in comments.

1 Comment

This should be the answer -- only one that worked for me. Thanks!
1

How large is your file?. You might as well do it from a console:

mysql -u##USER## -p ##YOUR_DATABASE## < ##PATH_TO_YOUR_FILE##

Do that without executing your mysql.ext file: just "cd" right into the directory and try the command.

It will ask for your password and start importing right away. Don't forget to create the database or delete all tables if it's already there.

I always found this approach quick, painless and easier that rolling around with php directives, phpmyadmin configuration or external applications. It's right there, built into the mysql core.

Comments

0

You should increase max_allowed_packet in MySQL.

Just execute this command before importing your file:

set global max_allowed_packet=1000000000;

2 Comments

I've executed it, but still fail with error message "You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit".
Within the same database connexion? Have you tried to add it manually at the start of your 28MB file? I know it is not good solution, but we will know if max_allowed_packet is the problem.
0

I also fetched the similar problem. So after that I also conclude , large sql file will never be imported to mysql. It will always give timeout error.

Then I found a solution.

There is an software Heidisql.

follow below steps:-

1) download the software.
2) then install the software
3) create new session in Heidisql and open the session
4) then go to Tools -> Load SQL File -> Browse. 

That's it. This solution works best for me.

check the link here

2 Comments

Note : Windows only for the benefit of people on other platforms
@MarkBaker yes . it's window's based.
0

I found the only solution was to log in to MySQL from the command line and use the 'source' command:-

1) cd to the directory containing your SQL file for import, then log into MySQL:

#> mysql -u YOURUSERNAME -p -h localhost

2) use MySQL commands to import the data:

#> use NAMEOFYOURDB;

#> source NAMEOFFILETOIMPORT.sql

This also feeds back info about progress to your terminal, which is reassuring.

Comments

0

Go to the php.ini file in the xamp click the config in the apach. Then in the text file type these commands.you may vary these values according to your file size of the database

post_max_size = 900M
memory_limit = 1024M
max_execution_time = 6000
max_input_time = 6000

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.