Prerequities:
You need to have MySQL client installed.
Dumping a database is usefull when moving data and backup data.
These examples shows you how to export a database. It is a good idea to export your data often as a backup.
First connect to the mysql server that has the database and use this command line.
mysqldump -u username -ppassword database_name > database_name.sql
Replace username, password and database_name with your MySQL username, password and database name. File database_name.sql now holds a backup of your database, download it to your computer.
Or
you can do this from your Linux shell
mysqldump -u username -h hostname.of.server.com -ppassword database_name > database_name.sql
Gunzip
mysqldump -u username -h localhost -p database_name | gzip -9 > backup_db.sql.gz
mysqldump -u username -h localhost -p database_name | bzip2 -c > backup_db.sql.bz2
This will remotely connect to the server and download it if you're remote.
No comments available.
Post new comment