mysqldump

Backups MySQL databases. See also mysql for restoring databases. More information: <https://dev.mysql.com/doc/refman/en/mysqldump.html>.

Install

All systems
curl cmd.cat/mysqldump.sh
Debian Debian
apt-get install mariadb-client-10.3
Ubuntu
apt-get install percona-xtradb-cluster-client-5.5
Arch Arch Linux
pacman -S percona-server-clients
image/svg+xml Kali Linux
apt-get install mariadb-client-10.1
Fedora
dnf install mariadb-3
Windows (WSL2)
sudo apt-get update sudo apt-get install percona-xtradb-cluster-client-5.5
Raspbian
apt-get install mariadb-client-5.5

Backups MySQL databases. See also mysql for restoring databases. More information: <https://dev.mysql.com/doc/refman/en/mysqldump.html>.

  • Create a backup (user will be prompted for a password):
    mysqldump --user user --password database_name --result-file=path/to/file.sql
  • Backup a specific table redirecting the output to a file (user will be prompted for a password):
    mysqldump --user user --password database_name table_name > path/to/file.sql
  • Backup all databases redirecting the output to a file (user will be prompted for a password):
    mysqldump --user user --password --all-databases > path/to/file.sql
  • Backup all databases from a remote host, redirecting the output to a file (user will be prompted for a password):
    mysqldump --host=ip_or_hostname --user user --password --all-databases > path/to/file.sql

© tl;dr; authors and contributors