问题描述:
很多虚拟主机的用户无法使用root登录数据库,在禅道16.5之后升级时代码中加入了检查root用户,导致升级失败,删除即可。
升级时报错类似:
SQLSTATE[42000]: Syntax error or access violation: 1227 Access denied; you need (at least one of) the SUPER privilege(s) for this operation<p>The sql is: SET global log_bin_trust_function_creators = 1</p>
SQLSTATE[42000]: Syntax error or access violation: 1227 Access denied; you need (at least one of) the SUPER privilege(s) for this operation<p>The sql is:
SET global sql_mode = ''</p>
SQLSTATE[42000]: Syntax error or access violation: 1370 alter routine command denied to user 'zentao'@'localhost' for routine 'zentao.get_monday'<p>The sql is:
DROP FUNCTION IF EXISTS `get_monday`</p>
SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'zentao'@'localhost' to database 'zentao'<p>The sql is:
CREATE FUNCTION `get_monday`(day date) RETURNS date
begin if date_format(day, '%w') = 0 then return subdate(day, date_format(day, '%w') - 6);
else return subdate(day, date_format(day, '%w') -1);
end if;
END</p>
解决方法:
连接mysql 的账号不是root 权限导致的 , 还原升级前的状态 , 如下方式任选其一
方式1 连接mysql的用户使用 root 账号
方式2 编辑db/updatefunctions.sql 里面的第一二行删除