Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using php to load mysqldumps

Status
Not open for further replies.

pushyr

Programmer
Jul 2, 2007
159
GB
i have a single mysqldump file with quite a few large tables. the file totals about 4.5gb

i would like to load the file (all these tables and their contents) into a mysql database using php

after searching i couldn't really find anything that put me on the right path.

how would go about doing this? or, is it more advisable to export dumps of individual tables? but still being pretty large tables how best would i load just one?
 
Any reason you want to use PHP rather than just feeding it directly into mysql itself?

mysql --verbose --user=XXXXXXXX --password=XXXXXXXX DB_NAME < /PATH/TO/DUMPFILE.SQL


How was the dump created, what options where used?

Depending on the format that file has is how PHP is going to read it.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
or if you don't have command line access, use phpmyadmin
 
if using phpmyadmin there's a file size restriction (Max: 2,048 KiB)... how do i get rid of or override the restriction
 
Change php.ini for the following directives

file_uploads true
upload_max_filesize 500M
post_max_size 500M
 
Hi jpadie,

I made the changes like you said to my php.ini but got the following error when trying to upload a 144mb table via phpmyadmin

Script timeout passed, if you want to finish import, please resubmit same file and import will resume.

where you browse to select the file, I also noticed that it says (Max: 512 kKiB)

do I need to make further changes elsewhere like in phpmyadmin to prevent the timeout? Would be nice to upload the file in one go instead of resuming... espeicially when i have 300 tables to upload... plus the files don't have primary keys so not entirely sure if resuming will beging where it left it off?
 
actually guys... just realized I can seemlessly import using a sql client

cheers for everything!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top