Kenetix.net Home  
Home Discussion Forums Resources Utilities Resources More Stuff!
 
Linux

Restoring MySQL Dump (.sql) File using SSH/Shell

Friday, 05 September 2008 @ 01:51 AM

  So you have this HUGE MySQL SQL file of your PHP-Nuke site/blog/whatever. Like 500MB in size which PHPMYADMIN is unable to handle just by a regular browser upload. What do you do? Split the file into 3248723489 segments and upload them 1 by 1? Noooo indiano...

Well here's another alternative. With just 2 simple steps and a simple command (SSH command), you won't have to worry about opening the SQL file in wordpad ever again!

Step 1 - Upload the SQL file to your server. Lets assume the path to the file is:
/home/myserver/public_html/mysqlfile.sql

Step 2 - Run the SSH command:
Code:
mysql -u[username] -p[password] [name-of-db] < /file/to/the/db.sql


Assuming I have the following database info:
database name: mydatabase
database user: kenetix
database pass: mypass123

You will key this code in the terminal window (replacing all the database variables and the file path obviously):
Code:
mysql -ukenetix -pmypass123 mydatabase < /home/myserver/public_html/mysqlfile.sql


Simple? Yes, very. 2 things you may want to take note of:

- There is NO SPACE between the -u and -p commands (username/password).
- No status report will be given if the dump is successful. Just check the tables manually.


Hope this has been helpful. It definitely saved me lots of time backing up/restoring Kenetix.net numerous times.
 
 

Article Info

 

Posted by: Kenetix

Topic: Linux

Length: 215 Words

Comments: 2

Rating: 5 stars

Votes: 2

RSS Syndication: Enabled

 
 

Rating

 

Current Rating


(5 stars)
Excellent
Good
Average
Poor
Terrible

 
 

Article Options

 
Save to NewsboxSave to Newsbox
Print ArticlePrint Article
Add To FavoritesAdd To Favorites
Digg ArticleDigg Article
 
 

Comments List

 
Wow, okay thats great to know, will save me alot of time. Do you now about gunzip or the unzip command, or this command, * sh? I always have problems with that telling me files/directories not found when I know they're there, and I try to chmod them and it silently succeeds so... Let me know

Posted By Posted By: undergrew | Date Date: Tuesday, Sep 30 2008, 07:41 AM

Please send me a message if you ever get that

Posted By Posted By: undergrew | Date Date: Tuesday, Sep 30 2008, 14:21 PM

 

Post A Comment

 
You need to be logged in to submit a comment. Click the button below to login and return to this page.

 
Back To Top