问题
I have tried to backup postgresql database by using many methods but unable to do.Please help me.
/etc/crontab
0 6 * * * sudo pg_dump -U USERNAME -h REMOTE_HOST -p REMOTE_PORT NAME_OF_DB > LOCATION_AND_NAME_OF_BACKUP_FILE
.pgpass
localhost:5432:db_name:postgres:password
/etc/crontab
0 6 * * * /home/backup.php
backup.php
<?php
exec('pg_dump --dbname=postgresql://username:password@127.0.0.1:5432/mydatabase > dbbackup.sql',$output);
print_r($output);
?>
I tried this as well. https://dzone.com/articles/linux-database-backup-scheduler-script-postgresql
来源:https://stackoverflow.com/questions/56890449/unable-to-set-a-cron-job-to-take-backup-of-the-postgresql-database