skip to Main Content

I want to take backup of my database daily with cPanel cron job

I’ve tried this solutions but didn’t work for me

mysqldump -uCpenelUsername -pCpanelPassword dbname > testDB/$(date +%m-%d-%Y-%H.%M.%S)-name.sql

Can someone please guide me where I’m making a mistake

2

Answers


  1. Chosen as BEST ANSWER

    This command works perfect for me

    date=`date -I`; mysqldump -u cPanelusername -pcPanelpassword dbname > /home/cPanelusername/testDB/xbackup_$date.sql


  2. Make sure you are using your sudo user name sudo DB password, which is the root DB password, without that you cant export, next is the path, use something like this,

    home/your_server_name/testDB/$(date +%m-%d-%Y-%H.%M.%S)-name.sql 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search