mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-04-14 16:49:17 +02:00
Fix unable to create rduser in MySQL v5.7+
The original insert into user's method of creating rduser is not compatible with MySQL v5.7+. This moves to a standard create user statement. Also moved to grant statements rather than inserting directly into the db table to prevent possible changes to that causing issues in the future.
This commit is contained in:
parent
57aa913e6f
commit
5ff24a1374
@ -240,17 +240,13 @@ and we will try to get this straightened out.");
|
||||
if (check_remote_server(host)) {
|
||||
host=format_remote_host(host);
|
||||
}
|
||||
sql=QString().sprintf("insert into user set Host=\"%s\",\
|
||||
User=\"%s\",Password=PASSWORD(\"%s\")",
|
||||
(const char *)host, (const char *)login,(const char *)pwd);
|
||||
sql=QString().sprintf("create user %s@'%s' identified by '%s'",
|
||||
(const char *)login, (const char *)host, (const char *)pwd);
|
||||
q=new QSqlQuery(sql);
|
||||
delete q;
|
||||
sql=QString().
|
||||
sprintf("insert into db set Host=\"%s\",Db=\"%s\",\
|
||||
User=\"%s\",Select_priv=\"Y\",Insert_priv=\"Y\",Update_priv=\"Y\",\
|
||||
Delete_priv=\"Y\",Create_priv=\"Y\",Drop_priv=\"Y\",\
|
||||
Index_priv=\"Y\",Alter_priv=\"Y\",Lock_tables_priv=\"Y\"",
|
||||
(const char *)host, (const char *)dbname,(const char *)login);
|
||||
sql=QString().sprintf("grant SELECT, INSERT, UPDATE, DELETE, CREATE, DROP,\
|
||||
INDEX, ALTER, LOCK TABLES on %s.* to %s@'%s'",
|
||||
(const char *)dbname, (const char *)login, (const char *)host);
|
||||
q=new QSqlQuery(sql);
|
||||
delete q;
|
||||
q=new QSqlQuery("flush privileges");
|
||||
|
Loading…
x
Reference in New Issue
Block a user