Change how we set password when creating a MySQL user

the way we were doing it just failed on MySQL (proper, not MariaDB) 8.0
This commit is contained in:
Lance Edgar 2020-09-26 14:35:52 -05:00
parent c2cca7aa76
commit c9aebd84e9

View file

@ -70,8 +70,12 @@ def create_user(c, name, host='localhost', password=None, checkfirst=True):
if not checkfirst or not user_exists(c, name, host): if not checkfirst or not user_exists(c, name, host):
sql(c, "CREATE USER '{}'@'{}';".format(name, host)) sql(c, "CREATE USER '{}'@'{}';".format(name, host))
if password: if password:
sql(c, "SET PASSWORD FOR '{}'@'{}' = PASSWORD('{}');".format( # TODO: pretty sure this can go away, but leaving until certain
name, host, password), hide=True, echo=False) # sql(c, "SET PASSWORD FOR '{}'@'{}' = PASSWORD('{}');".format(
# name, host, password), hide=True, echo=False)
sql(c, "ALTER USER '{}'@'{}' IDENTIFIED BY '{}';".format(
name, host, password),
echo=False)
def db_exists(c, name): def db_exists(c, name):