CRON JOB For database Backup

used this cron job to get the database backup but in the email, i get an error of password, but the password is correct. Any Help

mysqldump -u naeem4440_demo1 -p Naeem4440_demo1 -B naeem4440_demo1 | mail -s “Database Backup” [email protected]

Inbox

Cron Daemon 2:30 PM (7 minutes ago)
Enter password: mysqldump: Got error: 1045: “Access denied for user ‘naeem4440_demo1’@‘localhost’ (using password: NO)” when trying to connect Null message body

pay i look here: Bash script for backup wordpress database

I am not using Wordpress, I have PHP websites, 4 subdomains, all are php, now i want to take the backup automatically using CRON to my gmail. but i failed everytime. it gives error of password, but the password is correct.

As you can see in the error “Enter password”, mysqldump is asking for the password because you are using -p yourpassword instead of -pyourpassword, you should remove the space or use --password=yourpassword

Edit: I forgot to say that you can dump the db using hestiacp command v-dump-database command and there is no need to write the password in the command:

Usage: v-dump-database USER DATABASE

Using your example::

v-dump-database naeem4440 naeem4440_demo1 | mail -s “Database Backup” [email protected]

v-dump-database naeem4440_demo1 naeem4440_demo1 | mail -s “Database Backup” [email protected]

v-dump-database naeem4440_demo1 | mail -s “Database Backup” [email protected]

I tested both of these commmands but it gives the following error: /bin/sh: 1: v-dump-database: not found
Null message body; hope that’s ok

database name: naeem4440_demo1
db username: naeem4440_demo1
password: Naeem4440_demo1

v-dump-database is part os hestiacp, use the entire path /usr/local/hestia/bin/v-dump-database

Using v-dump-database, the user is the name of the account, not the user of the DB, so if your account is naeem4440 use it as the user as I wrote in the example.

i have tried this command:
/usr/local/hestia/bin/v-dump-database naeem4440 naeem4440_demo1 | mail -s “Database Backup” [email protected]

the ressult is as follows:
Error: DB_SYSTEM is not enabled

/usr/local/hestia/func/main.sh: line 1568: /usr/local/hestia/conf/hestia.conf: Permission denied
/usr/local/hestia/func/main.sh: line 102: /usr/local/hestia/log/error.log: Permission denied

Run under admin user

Error: DB_SYSTEM is not enabled

under admin, it gives this above error

Use sudo

sudo /usr/local/hestia/bin/v-dump-database naeem4440 naeem4440_demo1 | mail -s “Database Backup” [email protected]

when i use, sudo it did send my any email ,
and when i run without sudo it gives this error, under admin

|### [email protected] [email protected]|7:10 PM (0 minutes ago)||

Error: DB_SYSTEM is not enabled