【问题标题】:AWS EC2 Crontab auto backup RDS MySQL databaseAWS EC2 Crontab 自动备份 RDS MySQL 数据库
【发布时间】:2017-08-15 12:51:44
【问题描述】:

在我的 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.

【问题讨论】:

  • 您需要备份 RDS 数据库实例还是对运行在 EC2 实例内的数据库执行 ETL 作业?
  • 我的要求是在 EC2 中做一个 cron 作业来备份在 RDS @Ashan 中运行的数据库

标签: mysql linux amazon-web-services amazon-ec2 amazon-rds


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-28
    • 1970-01-01
    • 1970-01-01
    • 2017-03-15
    • 1970-01-01
    • 1970-01-01
    • 2012-04-06
    • 2021-11-13
    相关资源
    最近更新 更多