PHP Bulletin Board Home
News About Home
Features of phpBB Test drive phpBB Downloads Support for phpBB The phpBB Community Styles for customising phpBB 3rd party modifications to phpBB

Support Home | Knowledge Base Home | Submit Article | Search Articles | Browse Articles
 How to backup and restore your database with SSH 
Description: How to backup and restore your database with SSH
Author: r6untouchable
Date: Wed Sep 24, 2003 9:37 pm
Type: HowTo
Keywords: database backup restore ssh mysql
Category: Administrating
Ok, so a lot of people are having trouble backing up and restoring...reasons varying from the query taking longer than the server upload time, corrupted files, improperly split files, etc. Anyway, here is how to do it through SSH.

First, you need an ssh client. PuTTY is an easy one to use and works well. Search for it on google and download it.

1. Under session, put your website name into the host name box. Use port 22, and make sure SSH is selected. Under SSH in the left menu, you may have to select a different protocol. I use 2. Click open.

2. Input your site administration username into the shell prompt. It will prompt you for a password. Enter this too. Use the cd command to change directories to where you want your backup to be stored.
To confirm the directory, type "pwd" without the quotes.
Input "mysqldump -u [username] -p --opt [databasename] > [backupfilename.sql]" substituting the correct username for your database, database name, and filename for the backup. It will prompt you for a password. Enter your SQL password. If it returns with a prompt and no errors, you successfully made a backup.

3. To restore the database, login as usual. Use the cd command to change directories to where your sql backup is stored. Use the ls command to verifty that the file is there and you have the correct name. Type "mysql -u[username] -p[password] [databasename] < [backupfilename.sql]" and press enter. do not put a space between u and your username, or p and your password. If it returns with a prompt, you successfully restored your database.

Username: Password:
News | Features | Demo | Downloads | Support | Community | Styles | Mods | Links | Merchandise | About | Home
 © Copyright 2002 The phpBB Group.