mysql_user: enabled autocommit to support MySQL 8

This commit is contained in:
Alexander Skiba 2023-01-11 20:00:51 +01:00
commit 56478f4d10

View file

@ -433,13 +433,13 @@ def main():
if check_implicit_admin: if check_implicit_admin:
try: try:
cursor, db_conn = mysql_connect(module, "root", "", config_file, ssl_cert, ssl_key, ssl_ca, db, cursor, db_conn = mysql_connect(module, "root", "", config_file, ssl_cert, ssl_key, ssl_ca, db,
connect_timeout=connect_timeout, check_hostname=check_hostname) connect_timeout=connect_timeout, check_hostname=check_hostname, autocommit=True)
except Exception: except Exception:
pass pass
if not cursor: if not cursor:
cursor, db_conn = mysql_connect(module, login_user, login_password, config_file, ssl_cert, ssl_key, ssl_ca, db, cursor, db_conn = mysql_connect(module, login_user, login_password, config_file, ssl_cert, ssl_key, ssl_ca, db,
connect_timeout=connect_timeout, check_hostname=check_hostname) connect_timeout=connect_timeout, check_hostname=check_hostname, autocommit=True)
except Exception as e: except Exception as e:
module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s has the credentials. " module.fail_json(msg="unable to connect to database, check login_user and login_password are correct or %s has the credentials. "
"Exception message: %s" % (config_file, to_native(e))) "Exception message: %s" % (config_file, to_native(e)))