How do I do mysql backup and restore?
Depending on the location of the web server and DB server, you can back up and restore as follows.
1. When the IP of the web server and DB server are the same
- PuTTY connects to the web server through the SSH program.
- [Backup] mysqldump -u (DBid) -p(DBpassword) DBname > backupfilename
- [Recovery] mysql -u (DBid) -p(DBpassword) DBname < backupfilename
2. When the IP of the web server and DB server are different
- PuTTY connects to the web server through the SSH program.
- [Backup] mysqldump -h DB server IP -u (DBid) -p(DBpassword) DBname > backupfilename
- [Recovery] mysql -u (DBid) -p(DBpassword) DBname < backupfilename