@@ -4275,6 +4275,8 @@ static int dump_grants(const char *user_role)
4275
4275
}
4276
4276
while ((row = mysql_fetch_row (tableres )))
4277
4277
{
4278
+ if (strncmp (row [0 ], "SET DEFAULT ROLE" , sizeof ("SET DEFAULT ROLE" )) == 0 )
4279
+ continue ;
4278
4280
fprintf (md_result_file , "%s;\n" , row [0 ]);
4279
4281
}
4280
4282
mysql_free_result (tableres );
@@ -4314,7 +4316,7 @@ static int dump_create_user(const char *user)
4314
4316
4315
4317
4316
4318
/*
4317
- dump all users and roles
4319
+ dump all users, roles and their grants
4318
4320
*/
4319
4321
4320
4322
static int dump_all_users_roles_and_grants ()
@@ -4351,7 +4353,9 @@ static int dump_all_users_roles_and_grants()
4351
4353
if (dump_create_user (row [0 ]))
4352
4354
result = 1 ;
4353
4355
/* if roles exist, defer dumping grants until after roles created */
4354
- if (!(maria_roles_exist || mysql_roles_exist ) && dump_grants (row [0 ]))
4356
+ if (maria_roles_exist || mysql_roles_exist )
4357
+ continue ;
4358
+ if (dump_grants (row [0 ]))
4355
4359
result = 1 ;
4356
4360
}
4357
4361
mysql_free_result (tableres );
@@ -4463,7 +4467,7 @@ static int dump_all_users_roles_and_grants()
4463
4467
"concat(QUOTE(User), '@', QUOTE(Host)) as u FROM mysql.user "
4464
4468
"/*M!100005 WHERE is_role='N' */" ))
4465
4469
return 1 ;
4466
- if (mysql_roles_exist && mysql_roles_exist && mysql_query_with_error_report (mysql , & tableres ,
4470
+ if (mysql_roles_exist && mysql_query_with_error_report (mysql , & tableres ,
4467
4471
"SELECT IF(DEFAULT_ROLE_HOST IS NULL, 'NONE', CONCAT(QUOTE(DEFAULT_ROLE_USER),"
4468
4472
" '@', QUOTE(DEFAULT_ROLE_HOST))) as r,"
4469
4473
" CONCAT(QUOTE(mu.USER),'@',QUOTE(mu.HOST)) as u "
0 commit comments