Web Hosting - Dedicated Servers
Hosting - Dedicated Servers
Web Hosting eCommerce Hosting Reseller Hosting Dedicated Server
Home

Backing up databases over SSH

Written by WebHosting Moderator   
Tuesday, 18 March 2008

Sometimes a MySQL database is simply too large to backup on a web based interface. In the event of this occurring, it is fairly easy to backup a database via SSH; all it takes is one command. This tutorial will show you how.

First of all, login to SSH either as root or elevate yourself to root status.

mysqldump -u user -p password -h host dbname > outputfile

The terms highlighted in bold need to be filled out by you. A brief overview of what they are:

  • user: The user that has access to the database you want to backup
  • password: The password of that user
  • host: Your database host; usually setting this to localhost works fine
  • dbname: The name of the database you want to backup
  • outputfile: The name of the file you want to backup the database to.

Here is an example:

mysqldump -u john -p johnpass -h localhost john_db > /home/john/backup.sql

This will backup the database john_db to /home/john/backup.sql. Keep in mind for very large files, this will take some time, so be patient. Once it is finished, you will be returned to the command line.

For more information regarding mysqldump and for tips about advanced usage, take a look at this article:

dev.mysql.com/doc/refman/5.0/en/mysqldump.html




If you found this tutorial helpful, you can bookmark it with your favourite tracker.

Reddit!Del.icio.us!Google!Live!Facebook!Slashdot!Netscape!Technorati!Blinklist!Yahoo!Ma.gnolia!Squidoo!
 
< Prev
 
 
RedHat Linux
cPanel Hosting
plesk windows
Fantastico SiteBuilder
 

AUSWEB Web Hosting PTY LTD © 2007 Network Info Data CenterPrivacy PolicySLA Terms and Conditions