The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Command for backup database only in home directory

Discussion in 'General Discussion' started by ASTRAPI, Jan 29, 2010.

  1. ASTRAPI

    ASTRAPI Well-Known Member

    Joined:
    Jul 8, 2008
    Messages:
    321
    Likes Received:
    0
    Trophy Points:
    16
    Hello

    I login to ssh and then i run this command:

    /scripts/pkgacct myname

    With this command i have a full backup in the home directory.

    How can i do the same but only to backup my database in the home directory in .gz format?

    Which command i must use?

    Thank you
     
  2. ASTRAPI

    ASTRAPI Well-Known Member

    Joined:
    Jul 8, 2008
    Messages:
    321
    Likes Received:
    0
    Trophy Points:
    16
  3. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Penang, Malaysia
    First, you will need to dump the mysql using mysqldump,

    mysqldump -u username -p password database_name > database.sql

    Then you will need to gzip it into gz format.

    gzip database.gz database.sql

    In short, do the following command,
    mysqldump -u username -p password database_name > database.sql; gzip database.gz database.sql

    WHERE the username is the database username and the password is database password.
     
  4. ASTRAPI

    ASTRAPI Well-Known Member

    Joined:
    Jul 8, 2008
    Messages:
    321
    Likes Received:
    0
    Trophy Points:
    16
    When i login to ssh and run this command it will go in the home directory?


    Or i must browse there and then run the command?

    Thank you
     
  5. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Penang, Malaysia
    No, it won't go to home directory unless you run the following command.

    cd /home; mysqldump -u username -p password database_name > database.sql; gzip database.gz database.sql
     
  6. ASTRAPI

    ASTRAPI Well-Known Member

    Joined:
    Jul 8, 2008
    Messages:
    321
    Likes Received:
    0
    Trophy Points:
    16
    Ok thanks :)
     
Loading...

Share This Page