How do I dump mysql database?

I have a database called prgsales in mysql server. I need to dump mysql database. How can I dump mysql database using the ssh and bash command line?

Use the mysqldump client tool to dump mysql or mariadb database on a Linux, Unix, macOS and other operating systems.

mysqldump example

A common mysqldump example is for making a backup of an entire database named foo as foo.sql:

mysqldump foo > foo.sql

One can load the dump file back into the server like this (restore):

mysql foo < foo.sql

Want to copy data from one MariaDB/MySQL server to another? Try

mysqldump --opt wp_blog | mysql --host=192.168.2.55 -C wp_db_blog

It is possible to dump several databases with one command:

mysqldump --databases db1 db2 > all_databases.sql

To dump all databases, use the --all-databases option:

mysqldump --all-databases > all_my_databases_backup.sql

See the following for more info





Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki