1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

mysql_user: fix error No database selected (#225)

* mysql_user: fix error No database selected

* add changelog
This commit is contained in:
Andrew Klychkov 2020-04-23 16:42:20 +03:00 committed by GitHub
parent 703daa9500
commit 5874c89cf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- mysql_user - fix the error No database selected (https://github.com/ansible/ansible/issues/68070).

View file

@ -441,7 +441,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
# Replacing empty root password with new authentication mechanisms fails with error 1396
if e.args[0] == 1396:
cursor.execute(
"UPDATE user SET plugin = %s, authentication_string = %s, Password = '' WHERE User = %s AND Host = %s",
"UPDATE mysql.user SET plugin = %s, authentication_string = %s, Password = '' WHERE User = %s AND Host = %s",
('mysql_native_password', encrypted_password, user, host)
)
cursor.execute("FLUSH PRIVILEGES")