MySQL:select command denied to user for table 'proc'案例

使用EMS MySQL Manager Pro(3.4.0.1)连接MySQL 5.6.20时,报SELECT command denied to user [email protected] for table 'proc'

 

 

clip_image001

 

很是纳闷,后面使用同样的权限,发现使用命令工具mysql -h xxxx -u username -p连接时不会报错。个人猜测是因为EMS MySQL Manager(3.4.0.1)连接数据库时,会去查询mysql.proc下的对象(存储过程、函数等)。于是在测试服务器开启了MySQL查询日志,然后在客户端电脑使用EMS MySQL Manager Pro连接到数据库(Connect to Database),然后检查查询日志具体信息,发现如下所示,EMS MySQL Manager连接数据库时确实会去查询mysql.proc, 而因为权限问题,所以报如上错误:

 

#tail -60f /var/lib/mysql/mytestlnx02.log 
/usr/sbin/mysqld, Version: 5.6.41 (MySQL Community Server (GPL)). started with:
Tcp port: 3306  Unix socket: /var/lib/mysql/mysql.sock
Time                 Id Command    Argument
190108 14:54:07   111 Connect   mytest@letnb00021 on 
                  111 Query     SHOW VARIABLES
                  111 Query     SHOW STATUS
                  111 Quit
                  112 Connect   mytest@letnb00021 on MyDB
                  112 Query     BEGIN
                  112 Query     show collation
                  112 Query     SHOW VARIABLES
                  112 Query     SHOW ENGINES
                  112 Query     SHOW FULL TABLES
                  112 Query     SHOW FULL TABLES
                  112 Query     SHOW COLUMNS FROM `mysql`.`proc`
                  112 Query     SHOW INDEX FROM `mysql`.`proc`
                  112 Query     select p.`db`, p.`name`, p.`type`, p.`specific_name`, p.`language`, p.`sql_data_access`, p.`is_deterministic`, p.`security_type`, p.`param_list`, p.`returns`, p.`body`, p.`definer`, p.`created`, p.`modified`, p.`sql_mode`, p.`comment` from `mysql`.`proc` as p where p.`type` = 'PROCEDURE' and p.`db`='MyDB'

 

 

解决方案:

 

1:使用root账号登录数据库,执行下面SQL语句即可解决问题(使用具体账号替换usename)

 

grant select on mysql.proc to username

 

 

    2: 在对应的Register Database里"Display Options" 取消"Procedures"、"Functins"、"UDFS"也可以。这样EMS MySQL Manager连接数据库时,不会去查询相关的存储过程、函数等对象。就不会报这个错误。但是呢,这样就会在工具里面看不到这些对象。

 

   

clip_image002

猜你喜欢

转载自www.cnblogs.com/kerrycode/p/10239842.html
今日推荐