Bug 22128: Use DROP USER IF EXISTS instead of GRANT USAGE before DROP USAGE
MySQL 5.7 is old, and the latest versions fail on "GRANT USAGE" if the user does not exist. "DROP USER IF EXISTS" has been with us since 5.7, so all users should have it by now. This patch fixes the issue. To test: Try to koha_remove a site, and if it works with no errors, all good! Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
4dcf416dc9
commit
e9bb407f62
|
|
@ -67,10 +67,8 @@ do
|
|||
then
|
||||
# The grant creates the user in case it isn't, we don't want our loop to fail if it has already being deleted.
|
||||
mysql --defaults-extra-file=/etc/mysql/koha-common.cnf <<eof
|
||||
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`%\`;
|
||||
GRANT USAGE ON \`koha_$name\`.* TO \`koha_$name\`@\`$mysql_hostname\`;
|
||||
DROP USER \`koha_$name\`@\`%\`;
|
||||
DROP USER \`koha_$name\`@\`$mysql_hostname\`;
|
||||
DROP USER IF EXISTS \`koha_$name\`@\`%\`;
|
||||
DROP USER IF EXISTS \`koha_$name\`@\`$mysql_hostname\`;
|
||||
DROP DATABASE IF EXISTS \`koha_$name\`;
|
||||
FLUSH PRIVILEGES;
|
||||
eof
|
||||
|
|
|
|||
Loading…
Reference in New Issue