Tag Archives: mysqldump

HOW TO MySQL DUMP from terminal

You can create mysqldump like this:

mysqldump --defaults-extra-file=/path/to/config.cnf
Code language: JavaScript (javascript)

create config.cnf:

[client] user = whatever password = whatever host = whatever

Now lets backup a database

mysqldump --defaults-extra-file=/path/to/config.cnf database > /root/export.sql
Code language: JavaScript (javascript)

.tar.gz /var/www and vardump mysql database and scp ssh to another server – simple backup solution

First things first. With this small and simple tar command we archive all our /var/www/ data.

tar -zcvf archive.tar.gz /var/www
Code language: JavaScript (javascript)

Now we dump the MySQL database with the next command.

mysqldump -u root -p databasename > /root/backupname.sql
Code language: JavaScript (javascript)

You will be asked to write the password for the database user (in this case root).

scp archive.tar.gz root@destinationserver:/root scp /root/backupname.sql root@destinationserver:/root

Again you will be asked twice for the password of the remote server but all your sensitive data will be saved there.
Again this is a very simple and just a small demonstration of what you can do with tar, scp and ssh.