阿里云RDS提示mysql: [Warning] Using a password on the command line interface can be insecure

前沿

今天通过ECS对阿里云rds数据库进行导入。一直报错。

mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1227 (42000) at line 18: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

我们也在其他RDS上 导入多次都是没问题的。一直报错权限不足。。最后查询资料 是阿里云目前RDS不提供SUPER权限。

阿里云RDS提示mysql: [Warning] Using a password on the command line interface can be insecure

错误信息

mysql: [Warning] Using a password on the command line interface can be insecure.

ERROR 1227 (42000) at line 18: Access denied; you need (at least one of) the SUPER privilege(s) for this operation

出现场景

阿里云RDS

错误原因

  • 导RDS for MySQL实例时,SQL语句中含有需要Supper权限才可以执行的语句,而RDS for MySQL不提供Super权限,因此需要去除这类语句。
  • 本地MySQL实例没有启用GTID。

 

解决办法

 

  • 去除DEFINER子句:
    1. 检查SQL文件,去除下面类似的子句。
      DEFINER=`root`@`%` 
    2. 在Linux平台下,可以尝试使用下面的语句去除。
      sed -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/ ' your.sql > your_revised.sql
  • 去除GTID_PURGED子句
    1. 检查SQL文件,去除下面类似的子句。
      SET @@GLOBAL.GTID_PURGED='d0502171-3e23-11e4-9d65-d89d672af420:1-373,
      d5deee4e-3e23-11e4-9d65-d89d672a9530:1-616234';
    2. 在Linux平台下,可以尝试使用下面的语句去除。
      awk '{ if (index($0,"GTID_PURGED")) { getline; while (length($0) > 0) { getline; } } else { print $0 } }' your.sql | grep -iv 'set @@' > your_revised.sql

总结

尽量不要多次切换数据库名 用户名。以免造成这个情况。

广告 商祺云-专业提供阿里云、腾讯云产品  折上折  返点优惠  QQ 690624

主题测试文章,只做测试使用。发布者:云大使,转转请注明出处:https://www.xp8.net/data/3695.html

(0)
打赏 微信扫一扫 微信扫一扫
云大使的头像云大使
上一篇 2019年5月21日 下午10:16
下一篇 2019年6月26日 上午11:10

相关推荐

发表回复

登录后才能评论
联系我们

联系我们

18838889666

在线咨询: QQ交谈

邮件:xinyun@88.com

工作时间:周一至周五,9:30-18:30,节假日休息

添加微信
添加微信
分享本页
返回顶部
学派网官网正在升级改造中,如有影响访问,敬请谅解