mysql导数据遇到错误提示ERROR 1227,Acess denied
来源:互联网 发布:sql 删除表中的行 编辑:程序博客网 时间:2024/06/14 23:06
作者:天一阁图书管理员
今天群里有前同事在问mysqldump出来的sql文件在导入的时候,报错error1227(42000)at line 18: Acess denied; you need (at least one of) the SUPER privilege(s) for this operation
定位到18行显示的是一个这样的语句: set @@session.sql_log_bin=0;
按正常情况来说是不会出现这种情况的,这个语句只是控制当前session的查询是否写入binlog。群里的人都觉得这个问题很奇怪。
解决方案1:
大家看到既然是权限问题,那么就提权吧,或者使用root吧。但是前同事说是跳板机转过去的,没有办法用root,而提权和授权(grant)也需要root权限。方案1被否。
解决方案2:
既然不能用root,只能想其它办法了,但是我疑惑的是,为什么会出现用户无法控制自己的session变量的情况?于是搜索了一下,跳到mysql官网,找到这样一段描述:
sql_log_binThis variable controls whether logging to the binary log is done. The default value is 1 (do logging). To change logging for the current session, change the session value of this variable. The session user must have the [SUPER](https://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html#priv_super) privilege to set this variable.*Setting this variable to 0 prevents GTIDs from being assigned to transactions in the binary log*. If you are using GTIDs for replication, this means that, even when binary logging is later enabled once again, the GTIDs written into the log from this point do not account for any transactions that occurred in the meantime—in effect, those transactions are lost.In MySQL 5.7, it is not possible to set @@session.sql_log_bin within a transaction or subquery. (Bug #53437)
注意最后一行,上面说MySQL5.7有个bug,无法在子查询或者事务中执行set @@session.sql_log_bin。但是尽信书不如无书,我自己在mysql中执行了一下:
mysql> select version();+-------------------------+| version() |+-------------------------+| 5.7.16-0ubuntu0.16.04.1 |+-------------------------+1 row in set (0.00 sec)mysql> set @@session.sql_log_bin=0;Query OK, 0 rows affected (0.03 sec)
说明这个bug已经修复了,那这个同事用的mysql版本是不是声名狼藉的mysql5.6?让他确认了一下,确实是5.6。到此问题的根源找到了,解决方法也就有了。直接删除sql中所有的set @@session.sql_log_bin语句就可以了。
- mysql导数据遇到错误提示ERROR 1227,Acess denied
- 使用DOS中的DEL命令不能删除文件怎么办,错误提示Acess is Denied
- 遇到错误ERROR 1044 (42000): Access denied for user ''@'localhost'to database 'mysql',的解决办法
- mySql重装后遇到error nr.1045 access denied for user 'root' @'localhost'(using password :NO)错误
- mysql 导数遇到的问题
- imp-00003: 遇到 ORACLE 错误 20001,导数据出现问题
- IMP-00003: 遇到 ORACLE 错误 20001,导数据出现问题
- 从mysql导数据到sqlite,遇到单引号问题
- MySQL提示Access denied for user 'ODBC'@'localhost'错误
- centos中卸载mysql,Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误
- mysql 数据库 提示错误error 1146
- Mysql之导数据
- Mysql 导数据
- mysql导数据库
- MySQL导数据
- 关于、1045-Acess denied for user:'root'@'localhost'(Using password:YES)之类的错误
- 【nysql】1045-Acess denied for user:'root'@'localhost'(Using password:YES)错误处理
- 新装mysql后登录出现root帐号提示mysql ERROR 1045 (28000): Access denied for use
- 验证码的产品体验
- 小心stringstream.str()字符串用法的陷阱
- 爬虫问题汇总 + 解决
- 字符集GBK,GB2312,GB18030,UNICODE,UTF-8
- PyQt标准框——QInputDialog(二)
- mysql导数据遇到错误提示ERROR 1227,Acess denied
- twitter的snowflake算法
- Visual Studio Code 快捷键
- 身份证号码验证
- CAP理论——分布式基础理论
- 安卓自定义View进阶-分类与流程
- HDU 1561(树形DP)
- 高德地图实现公交路线-添加标记-轨迹回放-中心点-图层
- HTTP/2服务端推送