Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2008
    Posts
    42

    Arrow mysqldump in ssh

    If a friend of your's asked you what they should type in SSH to make a backup of a MySQL database so they would have it to restore if anything were to happen to their server (drive failure, DB corruption, etc etc).. what would you tell them to type in?

    The reason I ask this is because doing my own research on the net on how to backup a mysql database in SSH has shown me there are 10 million ways of doing it, with all kinds of modifiers and so forth. Not having a good grasp on what these modifiers do, I am not sure what to use?

    For instance, here is what I have been using:
    mysqldump --opt -udb_username -p db_name > /home/username/thebackupfile.sql

  2. #2
    Join Date
    Aug 2006
    Location
    Regina, Saskatchewan, CA
    Posts
    221
    The first thing here is that you're not really using SSH to make the backup. SSH is only the means by which you're accessing the server itself. Its like if you wanted to restart a Windows service from a remote workstation. You wouldn't be using remote desktop to restart the service. That's only how you get to the machine. You'd (likely) use services.msc or commands issues to the cmd prompt to restart the service.

    Once you're logged into the server, 'mysqldump --help' will show you all of the options you can specify with --opt (which is enabled by default). You can choose to not use the --opt option with --skip-opt.

    The man page for mysqldump will show you some typical uses of mysqldump. What you may want to do could be as simple as this, followed by hitting your enter key:

    Shell> mysqldump --databases <database_name> > /path/to/file.sql

    To do the restore, you might type something like this:

    Shell> mysql <database_name> -u <user> -p < /path/to/file.sql

    Because you used the "-p" switch, you'll be prompted for the database user's password. You won't see it when you type it in so be careful. An incorrect password will just cause the restore to fail; it shouldn't break anything.
    Bill - Support Analyst - Liveblock Auctions International
    http://www.LiveGlobalBid.com

  3. #3
    Join Date
    Oct 2004
    Location
    Kerala, India
    Posts
    4,750
    Quote Originally Posted by apacheMan View Post
    there are 10 million ways of doing it, with all kinds of modifiers and so forth.

    For instance, here is what I have been using:
    mysqldump --opt -udb_username -p db_name > /home/username/thebackupfile.sql

    This should work fine
    David | www.cliffsupport.com
    Affordable Server Management Solutions sales AT cliffsupport DOT com
    CliffWebManager | Access WHM from iPhone and Android

  4. #4
    Join Date
    Nov 2001
    Location
    Ann Arbor, MI
    Posts
    2,978
    -Mark Adams
    www.bitserve.com - Secure Michigan web hosting for your business.
    Only host still offering a full money back uptime guarantee and prorated refunds.
    Offering advanced server management and security incident response!

  5. #5
    man mysqldump if you don't know what the options mean.
    Linux/BSD Systems Administrator

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •