在我的EC2 Linux中,我想创建一个cron作业来自动备份AWS RDS中的MySql数据库。我试图运行
/usr/bin/mysqldump -u dbusername -p'dbpassword' dbname > /path/backup.sql
但我收到了错误
"Warning: Using a password on the command line interface can be insecure.
mysqldump: Got error: 1045: Access denied for user 'dbusername'@'localhost' (using password: YES) when trying to connect".
有什么问题,如何更改' dbusername' @' localhost'到' dbusername' @' xxx.xxxxxxxx.xx-xxxxxx-x.rds.amazonaws.com'?
我还试过写一个MySql脚本来下载backup.sh但是因为它不能超越
mysql -u 'dbusername' --password="dbpassword" -h 'xxx.xxxxxxxx.xx-xxxxxx-x.rds.amazonaws.com'
它能够登录,但它显示了MySQL提示
>
除此之外的任何事情。
> use db;
它会显示
Warning: Using a password on the command line interface can be insecure.
答案 0 :(得分:0)
mysqldump -u dbusername -p'dbpassword' -h hostname.here.com dbname > /path/backup.sql
相同的-h
适用于所有mysql *命令,例如如果你想连接到RDB:
mysqldump -u user -p'pass' -h db.us-east-1.rds.amazonaws.com dbname