SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Backing up and restoring MySQL Database

    I may be moving my site to a dedicated server in a month or so, and I need to know how to backup the MySQL database on my current server using SSH, and then how to restore it on my new server. Also, will this keep all of the data such as the username and password (so I won't have to edit all of my scripts)?

    -Josh

  2. #2
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Anyone??

  3. #3
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To dump a db:

    Code:
    mysqldump --opt -uyour_username -pyour_password database_name > /path/to/dump/file.sql
    If the db is large you can compress it:

    Code:
    mysqldump --opt -uyour_username -pyour_password database_name | gzip > /path/to/dump/file.gz
    To restore it:

    Code:
    mysql -uyour_username -pyour_password database_name < /path/to/dump/file.sql
    BTW - your signature should be 4 lines max

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  4. #4
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So when restoring it on the new server, the "-uyour_username -pyour_password database_name" section will allow me to set the username, password, and database name I had before (or if I want to change it, to whatever I want)?

    -Josh

  5. #5
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, use the username and password you have to use for MySQL on that host

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  6. #6
    SitePoint Addict
    Join Date
    Feb 2001
    Location
    -
    Posts
    389
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about the database name?


Bookmarks

Posting Permissions

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