Take the 2-minute tour ×
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. It's 100% free, no registration required.

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 stackoverflow.com Mar 1 '11 at 13:47

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

3 Answers 3

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

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

Your Answer


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