Where does the mysqldump command store the backed up databases?












10















I am trying to backup my databases through the terminal in Ubuntu using the mysqldump command and it's successful. Where does it place the backed up databases?



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.










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.























    10















    I am trying to backup my databases through the terminal in Ubuntu using the mysqldump command and it's successful. Where does it place the backed up databases?



    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.










    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.





















      10












      10








      10


      1






      I am trying to backup my databases through the terminal in Ubuntu using the mysqldump command and it's successful. Where does it place the backed up databases?



      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.










      share|improve this question
















      I am trying to backup my databases through the terminal in Ubuntu using the mysqldump command and it's successful. Where does it place the backed up databases?



      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.







      mysqldump ubuntu






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 mins ago









      Paul White

      51k14278450




      51k14278450










      asked Mar 1 '11 at 10:43







      Opolot Jerry Collins











      migrated from stackoverflow.com Mar 1 '11 at 13:47


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









      migrated from stackoverflow.com Mar 1 '11 at 13:47


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
























          4 Answers
          4






          active

          oldest

          votes


















          12














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



          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.






          share|improve this answer

































            10














            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































              7














              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































                1














                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








                  StackExchange.ready(function() {
                  var channelOptions = {
                  tags: "".split(" "),
                  id: "182"
                  };
                  initTagRenderer("".split(" "), "".split(" "), channelOptions);

                  StackExchange.using("externalEditor", function() {
                  // Have to fire editor after snippets, if snippets enabled
                  if (StackExchange.settings.snippets.snippetsEnabled) {
                  StackExchange.using("snippets", function() {
                  createEditor();
                  });
                  }
                  else {
                  createEditor();
                  }
                  });

                  function createEditor() {
                  StackExchange.prepareEditor({
                  heartbeatType: 'answer',
                  autoActivateHeartbeat: false,
                  convertImagesToLinks: false,
                  noModals: true,
                  showLowRepImageUploadWarning: true,
                  reputationToPostImages: null,
                  bindNavPrevention: true,
                  postfix: "",
                  imageUploader: {
                  brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                  contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                  allowUrls: true
                  },
                  onDemand: true,
                  discardSelector: ".discard-answer"
                  ,immediatelyShowMarkdownHelp:true
                  });


                  }
                  });














                  draft saved

                  draft discarded


















                  StackExchange.ready(
                  function () {
                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f1511%2fwhere-does-the-mysqldump-command-store-the-backed-up-databases%23new-answer', 'question_page');
                  }
                  );

                  Post as a guest















                  Required, but never shown
























                  4 Answers
                  4






                  active

                  oldest

                  votes








                  4 Answers
                  4






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  12














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



                  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.






                  share|improve this answer






























                    12














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



                    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.






                    share|improve this answer




























                      12












                      12








                      12







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



                      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.






                      share|improve this answer















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



                      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.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited 2 mins ago









                      Paul White

                      51k14278450




                      51k14278450










                      answered Mar 1 '11 at 10:47









                      RasikaRasika

                      22114




                      22114

























                          10














                          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




























                            10














                            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


























                              10












                              10








                              10







                              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













                              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












                              share|improve this answer



                              share|improve this answer










                              answered Aug 12 '11 at 21:35









                              randomxrandomx

                              2,97422240




                              2,97422240























                                  7














                                  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




























                                    7














                                    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


























                                      7












                                      7








                                      7







                                      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













                                      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












                                      share|improve this answer



                                      share|improve this answer










                                      answered Mar 1 '11 at 10:47







                                      Novikov






























                                          1














                                          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




























                                            1














                                            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


























                                              1












                                              1








                                              1







                                              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













                                              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












                                              share|improve this answer



                                              share|improve this answer










                                              answered Jun 22 '15 at 12:21









                                              selftaught91selftaught91

                                              1112




                                              1112






























                                                  draft saved

                                                  draft discarded




















































                                                  Thanks for contributing an answer to Database Administrators Stack Exchange!


                                                  • Please be sure to answer the question. Provide details and share your research!

                                                  But avoid



                                                  • Asking for help, clarification, or responding to other answers.

                                                  • Making statements based on opinion; back them up with references or personal experience.


                                                  To learn more, see our tips on writing great answers.




                                                  draft saved


                                                  draft discarded














                                                  StackExchange.ready(
                                                  function () {
                                                  StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f1511%2fwhere-does-the-mysqldump-command-store-the-backed-up-databases%23new-answer', 'question_page');
                                                  }
                                                  );

                                                  Post as a guest















                                                  Required, but never shown





















































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown

































                                                  Required, but never shown














                                                  Required, but never shown












                                                  Required, but never shown







                                                  Required, but never shown







                                                  Popular posts from this blog

                                                  SQL Server 17 - Attemping to backup to remote NAS but Access is denied

                                                  Always On Availability groups resolving state after failover - Remote harden of transaction...

                                                  Restoring from pg_dump with foreign key constraints