How to backup mysql database on ubuntu server

in #server8 years ago (edited)

How to backup mysql database on ubuntu server

Here is how to backup mysql database on ubuntu server, mysql database user "groovy"
password "XgjtCbnhZffdnbbf" mysql database data will be copied to a file "groovydump.sql"

login to ssh

login as: root
root@stoli.serverfarm.com's password:
Welcome to Ubuntu 12.04.5 LTS (GNU/Linux 2.6.32-042stab083.2 x86_64)

* Documentation:  https://help.ubuntu.com/
No mail.
Last login: Tue Jul  5 21:49:35 2016 from 41.203.71.186

root@stoli:~# mysqldump -ugroovy -pXgjtCbnhZffdnbbf --all-databases > groovydump.sql
root@stoli:~# ls
groovydump.sql  install.sh  Maildir  virtualmin-install.log

To restore dump

root@stoli:~# mysqldump -ugroovy -pXgjtCbnhZffdnbbf [database_name] < groovydump.sql