How to back up mysql database using cron jobs?

guymelef

Member
Nov 30, 2006
22
0
151
Hi,

I want to back up my mysql database once a week

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

mitul

Well-Known Member
Feb 8, 2003
291
0
166
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.
 

vladbbk

Registered
Feb 19, 2010
4
0
51
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
 

leomoreira

Registered
Mar 2, 2021
1
0
0
Brasil
cPanel Access Level
Reseller Owner
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
Maybe there's a missing space between the '-p' and the password itself in this command line hum?