Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pkg/util/mysql/mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (conn *Connection) Grant(username string, password string, database string,
database = "*"
}
{
sql := fmt.Sprintf("CREATE USER '%s'@'%s' IDENTIFIED BY '%s'", username, address, password)
sql := fmt.Sprintf("CREATE USER IF NOT EXISTS '%s'@'%s' IDENTIFIED BY '%s'", username, address, password)
_, err := conn.db.Exec(sql)
if err != nil {
return errors.Wrap(err, sql)
Expand All @@ -203,6 +203,7 @@ func (conn *Connection) Grant(username string, password string, database string,
if err != nil {
return errors.Wrap(err, sql)
}
conn.db.Exec("FLUSH PRIVILEGES")
}
return nil
}
Expand Down
Loading