简体   繁体   中英

Mysqldump in amazon using PHP

I want to have a database backup our database is hosted in amazon rds. My problem in everytime i run my PHP script it generates an sql file but it is empty.

Here is my code:

exec("/usr/bin/mysqldump -u *username* -p *password* | gzip > /var/www/html/db-backup/testdb.sql.gz");

I think that you need to specify which database you want to backup

exec("/usr/bin/mysqldump -u *username* -p*password* *dbname* | gzip > /var/www/html/db-backup/testdb.sql.gz");

and you have to specify password next to -p parameter without space (mysqldump -u youruser -pyourpassword -h yourhostname yourdatabase)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM