MYSQl Dump

Discussion in 'OT Technology' started by TRN, Feb 13, 2007.

  1. TRN

    TRN Well-Known Member

    Joined:
    Aug 22, 2003
    Messages:
    55,113
    Likes Received:
    130
    Location:
    North East
    What is the command to use within the mysql admin to do a dump of an entire db?

    :dunno:

    I am lost as hell.
     
    Last edited: Feb 13, 2007
  2. Cthalupa

    Cthalupa New Member

    Joined:
    May 5, 2006
    Messages:
    46,930
    Likes Received:
    0
    Location:
    Dallas, Texas
  3. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    From that page:


    The most common use of mysqldump is probably for making a backup of an entire database:
    shell> mysqldump db_name > backup-file.sql

    You can read the dump file back into the server like this:
    shell> mysql db_name < backup-file.sql
     
  4. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    This is our procedure for backing up and restoring a MySQL DB:

    PHP:
    mysqldump --routines --triggers --user=myuser -p foodatabase dump.sql

    Then enter myuser
    's pw.

    If this fails, try --user=root

    To recreate, you must add the following line to the top of dump.sql file:

    use foodatabase;

    To restore the database, you must use root like:

    mysql -u root -p <dump.sql 
    This takes care of all tables, stored procedures, and triggers, as well as all data.
     
  5. Coottie

    Coottie BOOMER......SOONER OT Supporter

    Joined:
    Jun 6, 2006
    Messages:
    32,407
    Likes Received:
    0
    Location:
    OKC
    That's cool...thanks peyomp.

    We're just starting to use MySQL in my Web Server Programming class and this will really come in handy!!
     
  6. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    No problem, just pasted out of our docs :)
     
  7. Cthalupa

    Cthalupa New Member

    Joined:
    May 5, 2006
    Messages:
    46,930
    Likes Received:
    0
    Location:
    Dallas, Texas
    trade secrets :noes:
     
  8. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    You'd be amazed at how much time little notes like that can save you. I just documented our entire Solaris install process, because being a douchebag, I did not do so before and the FLAR image we were to install from failed.

    Documentation cannot be skipped. Put off a little, maybe. But if you don't meet some minimum, you do not have a sustainable business.
     

Share This Page