• 学派吧-由新云网络独家赞助-https://www.sq9.cn。

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

MySQL admin 5年前 (2019-06-11) 5049次浏览 已收录 0个评论 扫描二维码
文章目录[隐藏]

前沿

今天通过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权限。

错误信息

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


学派吧 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:阿里云RDS提示mysql: [Warning] Using a password on the command line interface can be insecure
喜欢 (1)
[pay@sq9.cn]
分享 (0)
关于作者:
腾讯云-运维运维 QQ 690624
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址