Backup of database.

Discussion in 'MySQL' started by login, Apr 20, 2007.

  1. #1
    I want to move host and I need a copy/backup of my database. There is no cPanel or phpmyadmin. How can I make a backup ? My host says that I can use mysqldump from my own machine. I have no idea of what that is.
     
    login, Apr 20, 2007 IP
  2. linkstraffic

    linkstraffic Well-Known Member

    Messages:
    388
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    133
    #2
    try this command and it will backup everything as wished:

    # mysqldump --opt -u username --password=yourpasswd databasename > /pathtoyourfile/yourbackupfile.sql

    now you can upload the sql file to your new host and do this:
    mysql> source /pathtoyourfile/yourbackupfile.sql


    And if you have a large database, you better use the mysqldump command with compression option (check out the mysql website for some doc.)
     
    linkstraffic, Apr 20, 2007 IP
  3. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Thanks, but I am totally blank on this, where do I put this command ? and will I get a back up on my computer then ?

    # mysqldump --opt -u username --password=yourpasswd databasename > /pathtoyourfile/yourbackupfile.sql
     
    login, Apr 20, 2007 IP
  4. linkstraffic

    linkstraffic Well-Known Member

    Messages:
    388
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    133
    #4
    you issue the command from the command line of your server
    it will output the file inside 'yourbackupfile.sql' and inside the 'pathtoyourfile' directory.
     
    linkstraffic, Apr 24, 2007 IP
  5. ZYSeo

    ZYSeo Peon

    Messages:
    164
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Just upload phpMyAdmin there. It you have FTP access you can just upload phpMyAdmin and use it.
     
    ZYSeo, Apr 24, 2007 IP
  6. login

    login Notable Member

    Messages:
    8,849
    Likes Received:
    349
    Best Answers:
    0
    Trophy Points:
    280
    #6
    Ok thanks, I solved it, found out that wordpress has a database backup plug-in.
     
    login, Apr 24, 2007 IP
  7. asfi

    asfi Peon

    Messages:
    110
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Create a full backup of your database:

    shell> mysqldump --tab=/path/to/some/dir --opt db_name

    Or:

    shell> mysqlhotcopy db_name /path/to/some/dir.
    For more info go to http://dev.mysql.com/doc/refman/5.0/en/backup.html
     
    asfi, Apr 24, 2007 IP