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.

How to back up mysql database using cron jobs?

Discussion in 'Database Discussions' started by guymelef, Dec 15, 2006.

  1. guymelef

    guymelef Member

    Joined:
    Nov 30, 2006
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I want to back up my mysql database once a week

    How would I be able to do it using cron jons?
     
  2. mitul

    mitul Well-Known Member

    Joined:
    Feb 8, 2003
    Messages:
    291
    Likes Received:
    0
    Trophy Points:
    16
    Mysql backup can be schedule using mysqldump through cron.

    Below is the example.

    * * * * * mysqldump -u USERNAME -pPASSWORD database > database_backup.sql

    Set the days as per your requirements.
     
  3. instinctsamsung

    instinctsamsung Registered

    Joined:
    Apr 21, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    where does it save the SQL file?
     
  4. WebScHoLaR

    WebScHoLaR Well-Known Member

    Joined:
    Dec 14, 2005
    Messages:
    511
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    Planet Earth
    You can specify any location and the SQL file will be saved there.


    mysqldump -u USERNAME -pPASSWORD database > /path/to/sql/file/database_backup.sql
     
  5. vladbbk

    vladbbk Registered

    Joined:
    Feb 19, 2010
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    mysqldump -u USERNAME -pPASSWORD database > /path/to/sql/file/database_backup.sql

    Enter password: mysqldump: Got error: 1045: Access denied for user 'vlad_u'@'localhost' (using password: NO) when trying to connect


    Please hellp me
     
Loading...

Share This Page