Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    66
    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:
    66
  3. mickbeng

    mickbeng Well-Known Member

    Joined:
    Oct 3, 2006
    Messages:
    56
    Likes Received:
    0
    Trophy Points:
    156
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. ASTRAPI

    ASTRAPI Well-Known Member

    Joined:
    Jul 8, 2008
    Messages:
    321
    Likes Received:
    0
    Trophy Points:
    66
    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:
    156
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. ASTRAPI

    ASTRAPI Well-Known Member

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

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice