Backing up and restoring MySQL database is generally trivial task however when database is huge, it is really a pain to do so because of amount of time it takes to perform backup/restore operation with conventional tools like PHPMyAdmin or similar.
If you have SSH access to server, we can leverage built-in MySQL commands mysqldump
and mysql
respectively to backup and restore big database really fast.
To Backup Database:
mysqldump -uDB_USER_HERE -pDB_PASSWORD_HERE DATABASE_NAME_HERE > backup.sql
To Restore Database:
mysql -uDB_USER_HERE -pDB_PASSWORD_HERE DATABASE_NAME_HERE < backup.sql
Note: If you don't have SSH access, you can use tools like MySQLDumper which does fairly good job but not as fast as mysqldump
and mysql
commands of course.
No comments:
Post a Comment