# How to install & run mysqldump

mysqldump is part of the mysql-client package, which means you will have to install mysql-client in order to be able to use mysqldump.

In most cases, if you run the command from a machine that has the mysql-server package, mysql-client will also be available. In order to check if you already have it, just open your terminal and type mysqldump. If you get a command not found message you have to install it, otherwise you are good to go.

# How to install mysqldump on Ubuntu

sudo apt update
sudo apt install mysql-client

# How to run mysqldump

In order to run mysqldump, open your terminal, type mysqldump and you will see a list of usage examples.

To dump a database named my_app_db and create a dump.sql file, run:

mysqldump -uroot -p my_app_db > dump.sql

The -u flag stands for user and -p for password. In our case the user is root and after executing the command, you will be asked to type the password for that user.

# Next

In the next chapter you will see which flags are used by default when running mysqldump.