mirror of
https://github.com/ansible-collections/community.mysql.git
synced 2025-08-26 07:51:46 -07:00
mysql_user: optimize queries for existing passwords
This commit is contained in:
parent
21604ce58b
commit
95a5caf562
1 changed files with 2 additions and 2 deletions
|
@ -121,11 +121,11 @@ def get_existing_authentication(cursor, user):
|
|||
cursor.execute("""select plugin, auth from (
|
||||
select plugin, password as auth from mysql.user where user=%(user)s
|
||||
union select plugin, authentication_string as auth from mysql.user where user=%(user)s
|
||||
) x group by plugin, auth
|
||||
) x group by plugin, auth limit 2
|
||||
""", {'user': user})
|
||||
else:
|
||||
cursor.execute("""select plugin, authentication_string as auth from mysql.user where user=%(user)s
|
||||
group by plugin, authentication_string""", {'user': user})
|
||||
group by plugin, authentication_string limit 2""", {'user': user})
|
||||
rows = cursor.fetchall()
|
||||
if len(rows) == 1:
|
||||
return {'plugin': rows[0][0], 'auth_string': rows[0][1]}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue