executing a .SQL file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

executing a .SQL file

Post by psychotomus »

how can I execute a .SQL file. I just bought a couple databases and there's no install file. there just in .SQL file. i can't import them by uploading them due to the fact that the files are ove 8MB and my host only allows 8MB uploading.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Zip the SQL file, upload it to your sever...then uncompress it from the command line and execute it.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Post by Benjamin »

Executing an .sql file isn't really possible. .SQL files are generally plain text database exports. The best idea would be to upload it, then import it from a command line if you know how. Otherwise you could install phpMyAdmin, open the .sql file in a text editor, and import the database 1 table at a time for example.
velo
Forum Newbie
Posts: 7
Joined: Sun May 14, 2006 2:42 pm

Post by velo »

One thing I find terribly annoying is that is you export a db from PHPMyAdmin and then try to reimport it, the comments within the .sql will often cause the queries in the .sql to fail. So I've usually had to go through and remove all the commented lines. Not a tragedy, of course, just annoying and something to keep in mind......
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Read through raghavan20's posts in the regex board, there are several applicable to running an sql file.
Post Reply