Weborum Webmaster Forum > Importing & Exporting Databases with SSH
Help - Search - Members - Calendar
Full Version: Importing & Exporting Databases with SSH
Weborum Webmaster Forum > TUTORIAL ARCHIVE - tutorials & scripts to save you scouring the internet. Please feel free to add your own. > Web hosting tutorials
inogenius
Everyone's had that problem where they go to upload their massive database through PHPMyAdmin only to find that it times out halfway through. Here's a much easier, faster, and way cooler way to do it.

First, what you're going to want to do is upload the actual .sql file in to your /home/username/ directory. Once that is done, login to SSH (Assuming you have it, if not you can request it from your host) and run the command cd /home/username/ just to make sure you're in your home directory. Then, to import the database run;

mysql -uUsername -pPassword database_name < username.sql.

Now, to do a quick export of a mysql database to your home directory you can run the command;

mysqldump -uUSERNAME -pPASSWORD database_name < /home/username/database.sql
leo
Cheers Terry smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.