How to backup and restore ones database using mysqldump, etc.
Main
»
General
»
How to backup and restore ones database using mysqldump, etc.
MySQL Dump Using phpMyAdmin
There are many ways of doing a dump and a restore of a MySQL database but because this action is typically performed using a program such as phpMyAdmin, this is what we'll go over. phpMyAdmin can typically be found using your cpanel or plesk panel. If you are not sure about how to access phpMyAdmin or whether you have it installed then your web host or system admin should be able to assist you in locating or installing.
Using phpMyAdmin you can view the contents of your MySQL database.
To backup your database click on the Export tab at the top of the screen. Select all tables and be sure that AUTO_INCREMENT value is selected and then save as a file before selecting Go.
Your database has now been successfully dumped!
-----------
MySQL Restore Using phpMyAdmin
Now that we have exported the database into a .sql file we can now restore it into an empty database. Click on the Import tab at the top of the screen and to the right of the Export tab. Browse for your .sql file and then click Go.
Your database has now been successfully restored!
--------------------------
MySQL Dump Using SSH
Contact your server admin or web host and ask them for SSH access if you do not have this information.
1. Connect to host via SSH & run the following command: mysqldump --opt u user -p databasename > {path}/backup.sql
2. Once you run the command you will need to enter your password. It may take a little while to respond but once completed you will be taken back to where you started (bash/command line)
Your MySQL database has been successfully dumped! ------------------------
MySQL Restore Using SSH
phpMyAdmin will not be sufficient in most cases for restoring MySQL database so you will most likely need to rely on SSH.
1. Login to your site using your FTP client.
2. Find your existing .sql database and upload it to your server using your FTP client. It does not matter where on your site you upload it as long as you can execute the SSH command once you're in the folder
3. Close your FTP program
4. Login to your site using an SSH client such as putty.
5. Enter in the following command line, using your own database name, file name, username, and password:
mysql -uUSERNAME –pPASSWORD DATABASENAME < MYDATABASE.sql