Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Am trying to backup my databases through the terminal in Ubuntu using the mysqldump command and it's successful , but where does it place the backed up databases ?

share|improve this question

migrated from Mar 1 '11 at 13:47

This question came from our site for professional and enthusiast programmers.

By default it does it to the console. You need to redirect the output to a file if you need to save it.

share|improve this answer
I run the command like this "$ mysqldump -h localhost -u username - p database_name > back_up_db.sql" but have no idea where "back_up_db.sql " is stored. – Opolot Jerry Collins Mar 1 '11 at 10:54
In this case, in the same directory as you ran the command – JohnC Mar 1 '11 at 11:04
It is stored in your current directory. After you run the command, do $ pwd. That will tell you which directory you're in. – Novikov Mar 1 '11 at 11:05
But where should you put backups? For example on Ubuntu. Why does nobody seem to care about that? They just create a backup in whichever directory they're in... seems like a way to make your server a complete mess. – BadHorsie Dec 17 '15 at 17:12
The place you put the backup is up to you. Ideally, it should be on a different machine in a different physical location. This is why you usually do a remote MySQL dump over SSH and get the data on a different machine. You just pipe the console output over ssh into a file on a different machine. – Rasika Dec 18 '15 at 3:59

It should also be noted that the mysqldump command also has a switch for a destination file.

--result-file=file_name, -r file_name
share|improve this answer

Usually you use mysql dump like this

mysqldump -h host -u user -ppassword dbname > dumpfile

So the output is whatever file you redirect output to. The output file will contain instructions that will rebuild the database from scratch, including the schema, if your run it on a new install like so.

mysql -h host -u user -ppassword dbname < dumpfile

Here's wiki on IO redirection

share|improve this answer

It will be stored in the path or folder from where you run the mysql commandenter image description here suppose you run the command from root then it will be stored in the root directory

you can see my backup file skillmappingcleardata.sql in the root directory because I run the mysql command from there

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.