From 20a3cec34f105657cd935331c2fdc346d3e34189 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 21 Oct 2020 11:51:58 +1100 Subject: [PATCH] Anel review --- client/mysqldump.c | 131 ++++++++++++++++-------- man/mysqldump.1 | 3 +- mysql-test/r/mysqldump-system,win.rdiff | 37 ++++--- mysql-test/r/mysqldump-system.result | 4 +- 4 files changed, 113 insertions(+), 62 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index d03edb22ba5e2..2b41a2b571a65 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -118,17 +118,18 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m opt_alltspcs=0, opt_notspcs= 0, opt_logging, opt_drop_trigger= 0 ; #define OPT_SYSTEM_ALL 1 -#define OPT_SYSTEM_USER 2 -#define OPT_SYSTEM_PLUGIN 4 -#define OPT_SYSTEM_UDF 8 +#define OPT_SYSTEM_USERS 2 +#define OPT_SYSTEM_PLUGINS 4 +#define OPT_SYSTEM_UDFS 8 #define OPT_SYSTEM_SERVERS 16 #define OPT_SYSTEM_STATS 32 #define OPT_SYSTEM_TIMEZONES 64 static const char *opt_system_type_values[]= - {"all", "users", "plugins", "udf", "servers", "stats", "timezones"}; + {"all", "users", "plugins", "udfs", "servers", "stats", "timezones"}; static TYPELIB opt_system_types= { - array_elements(opt_system_type_values), "system dump options", opt_system_type_values, NULL + array_elements(opt_system_type_values), "system dump options", + opt_system_type_values, NULL }; static ulonglong opt_system= 0ULL; static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0; @@ -595,9 +596,9 @@ static int init_dumping_tables(char *); static int init_dumping(char *, int init_func(char*)); static int dump_databases(char **); static int dump_all_databases(); -static int dump_all_users(); +static int dump_all_users_roles_and_grants(); static int dump_all_plugins(); -static int dump_all_udf(); +static int dump_all_udfs(); static int dump_all_servers(); static int dump_all_stats(); static int dump_all_timezones(); @@ -1054,32 +1055,32 @@ static int get_options(int *argc, char ***argv) if (opt_system & OPT_SYSTEM_ALL) opt_system|= ~0; - if (opt_system & OPT_SYSTEM_USER && + if (opt_system & OPT_SYSTEM_USERS && (my_hash_insert(&ignore_table, (uchar*) my_strdup("mysql.db", MYF(MY_WME))) || my_hash_insert(&ignore_table, (uchar*) my_strdup("mysql.global_priv", MYF(MY_WME))) || my_hash_insert(&ignore_table, - (uchar*) my_strdup("mysql.table_priv", MYF(MY_WME))) || + (uchar*) my_strdup("mysql.tables_priv", MYF(MY_WME))) || my_hash_insert(&ignore_table, - (uchar*) my_strdup("mysql.column_priv", MYF(MY_WME))) || + (uchar*) my_strdup("mysql.columns_priv", MYF(MY_WME))) || my_hash_insert(&ignore_table, (uchar*) my_strdup("mysql.procs_priv", MYF(MY_WME))) || my_hash_insert(&ignore_table, (uchar*) my_strdup("mysql.roles_mapping", MYF(MY_WME))) || - /* and MySQL-8.0 role tables as well */ + /* and MySQL-8.0 role tables (role_edges and default_roles) as well */ my_hash_insert(&ignore_table, (uchar*) my_strdup("mysql.role_edges", MYF(MY_WME))) || my_hash_insert(&ignore_table, (uchar*) my_strdup("mysql.default_roles", MYF(MY_WME))))) return(EX_EOM); - if (opt_system & OPT_SYSTEM_PLUGIN && + if (opt_system & OPT_SYSTEM_PLUGINS && my_hash_insert(&ignore_table, - (uchar*) my_strdup("mysql.plugins", MYF(MY_WME)))) + (uchar*) my_strdup("mysql.plugin", MYF(MY_WME)))) return(EX_EOM); - if (opt_system & OPT_SYSTEM_UDF && + if (opt_system & OPT_SYSTEM_UDFS && my_hash_insert(&ignore_table, (uchar*) my_strdup("mysql.func", MYF(MY_WME)))) return(EX_EOM); @@ -4254,16 +4255,18 @@ static char *getTableName(int reset) /* dump user/role grants + ARGS + user_role: is either a user, or a role */ -static int dump_grants(const char *ur) +static int dump_grants(const char *user_role) { DYNAMIC_STRING sqlbuf; MYSQL_ROW row; MYSQL_RES *tableres; init_dynamic_string_checked(&sqlbuf, "SHOW GRANTS FOR ", 256, 1024); - dynstr_append_checked(&sqlbuf, ur); + dynstr_append_checked(&sqlbuf, user_role); if (mysql_query_with_error_report(mysql, &tableres, sqlbuf.str)) { @@ -4281,7 +4284,7 @@ static int dump_grants(const char *ur) /* - dump creater user + dump create user */ static int dump_create_user(const char *user) @@ -4310,12 +4313,11 @@ static int dump_create_user(const char *user) } - /* dump all users and roles */ -static int dump_all_users() +static int dump_all_users_roles_and_grants() { MYSQL_ROW row; MYSQL_RES *tableres; @@ -4327,9 +4329,11 @@ static int dump_all_users() if (mysql_query_with_error_report(mysql, &tableres, "SELECT CONCAT(QUOTE(u.user), '@', QUOTE(u.Host)) AS u " "FROM mysql.user u " - " /*!80001 LEFT JOIN mysql.role_edges e ON u.user=e.from_user AND u.host=e.from_host " - " WHERE e.from_user IS NULL */" - " /*M!100005 WHERE is_role='N' */")) + " /*!80001 LEFT JOIN mysql.role_edges e " + " ON u.user=e.from_user " + " AND u.host=e.from_host " + " WHERE e.from_user IS NULL */" + " /*M!100005 WHERE is_role='N' */")) return 1; while ((row= mysql_fetch_row(tableres))) { @@ -4337,11 +4341,12 @@ static int dump_all_users() /* Protection against removing the current import user */ /* MySQL-8.0 export capability */ fprintf(md_result_file, - "DELIMITER |\n" + "DELIMITER |\n" "/*M!100101 IF current_user()=\"%s\" THEN\n" - " SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT=\"Don't remove current user %s'\";\n" + " SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001," + " MESSAGE_TEXT=\"Don't remove current user %s'\";\n" "END IF */|\n" - "DELIMITER ;\n" + "DELIMITER ;\n" "/*!50701 DROP USER IF EXISTS %s */;\n", row[0], row[0], row[0]); if (dump_create_user(row[0])) result= 1; @@ -4354,15 +4359,37 @@ static int dump_all_users() if (!(maria_roles_exist || mysql_roles_exist)) goto exit; - /* preserve current role. Create a new role for importing that becomes the - * default admin for new roles, so it can be dropped after roles are assigned */ + /* + Preserve current role active role, in case this dump is imported + in the same connection that assumes the active role at the beginning + is the same as at the end of the connection. This is so: + + #!/bin/sh + ( + echo "set role special_role; "; + cat mysqldump.sql; + echo "$dosomethingspecial" + ) | mysql -h $host + + doesn't end up with a suprise that the $dosomethingspecial cannot + be done because `special_role` isn't active. + + We create a new role for importing that becomes the default admin for new + roles. This is because without being a admin on new roles we don't + have the necessary privileges to grant users to a created role or to + create new admins for the created role. + At the end of the import the mariadb_dump_import_role is be dropped, + which implictly drops all its admin aspects of all the role. + This is significiantly easlier than revoking the ADMIN of each role + from the current user. + */ fputs("SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;\n" "CREATE ROLE IF NOT EXISTS mariadb_dump_import_role;\n" "GRANT mariadb_dump_import_role TO CURRENT_USER();\n" "SET ROLE mariadb_dump_import_role;\n" , md_result_file); /* No show create role yet, MDEV-22311 */ - /* Roles, with user admins first, then roles they adminster, and recurse on that */ + /* Roles, with user admins first, then roles they administer, and recurse on that */ if (maria_roles_exist && mysql_query_with_error_report(mysql, &tableres, "WITH RECURSIVE create_role_order AS" " (SELECT 1 as n, roles_mapping.*" @@ -4401,7 +4428,8 @@ static int dump_all_users() " JOIN mysql.role_edges re ON c.FROM_USER=re.TO_USER" " AND c.FROM_HOST=re.TO_HOST) " "SELECT CONCAT(QUOTE(FROM_USER), '/*!80001 @', QUOTE(FROM_HOST), '*/') AS r," - " CONCAT(QUOTE(TO_USER), IF(n=1, CONCAT('@', QUOTE(TO_HOST)), CONCAT('/*!80001 @', QUOTE(TO_HOST), ' */'))) AS u," + " CONCAT(QUOTE(TO_USER), IF(n=1, CONCAT('@', QUOTE(TO_HOST))," + " CONCAT('/*!80001 @', QUOTE(TO_HOST), ' */'))) AS u," " WITH_ADMIN_OPTION " "FROM create_role_order " "ORDER BY n," @@ -4436,7 +4464,8 @@ static int dump_all_users() "/*M!100005 WHERE is_role='N' */")) return 1; if (mysql_roles_exist && mysql_roles_exist && mysql_query_with_error_report(mysql, &tableres, - "SELECT IF(DEFAULT_ROLE_HOST IS NULL, 'NONE', CONCAT(QUOTE(DEFAULT_ROLE_USER), '@', QUOTE(DEFAULT_ROLE_HOST))) as r," + "SELECT IF(DEFAULT_ROLE_HOST IS NULL, 'NONE', CONCAT(QUOTE(DEFAULT_ROLE_USER)," + " '@', QUOTE(DEFAULT_ROLE_HOST))) as r," " CONCAT(QUOTE(mu.USER),'@',QUOTE(mu.HOST)) as u " "FROM mysql.user mu LEFT JOIN mysql.default_roles using (USER, HOST)")) return 1; @@ -4489,7 +4518,7 @@ static int dump_all_plugins() if (mysql_query_with_error_report(mysql, &tableres, "SHOW PLUGINS")) return 1; - /* Name, Status, Type, Library,License */ + /* Name, Status, Type, Library, License */ while ((row= mysql_fetch_row(tableres))) { if (strcmp("ACTIVE", row[1]) != 0) @@ -4497,8 +4526,14 @@ static int dump_all_plugins() /* Should we be skipping builtins? */ if (row[3] == NULL) continue; + if (opt_replace_into) + { + fprintf(md_result_file, "/*M!100401 UNINSTALL PLUGIN IF EXIST %s */;\n", + row[0]); + } fprintf(md_result_file, - "INSTALL PLUGIN %s %s SONAME '%s';\n", row[0], opt_ignore ? "/*!100401 IF NOT EXISTS */" : "", row[3]); + "INSTALL PLUGIN %s %s SONAME '%s';\n", row[0], + opt_ignore ? "/*M!100401 IF NOT EXISTS */" : "", row[3]); } mysql_free_result(tableres); @@ -4507,16 +4542,16 @@ static int dump_all_plugins() /* - dump all udf + dump all udfs */ -static int dump_all_udf() +static int dump_all_udfs() { /* we don't support all these types yet, but get prepared if we do */ static const char *udf_types[] = {"STRING", "REAL", "INT", "ROW", "DECIMAL", "TIME" }; MYSQL_ROW row; MYSQL_RES *tableres; - int retresult; + int retresult, result= 0; if (mysql_query_with_error_report(mysql, &tableres, "SELECT * FROM mysql.func")) return 1; @@ -4526,9 +4561,15 @@ static int dump_all_udf() retresult= atoi(row[1]); if (retresult < 0 || array_elements(udf_types) <= (size_t) retresult) { - fprintf(stderr, "%s: Error: invalid return type on udf function '%s'\n", + fprintf(stderr, "%s: Error: invalid return type on udf function '%s'\n", my_progname_short, row[0]); - return 1; + result= 1; + continue; + } + if (opt_replace_into) + { + fprintf(md_result_file, "/*!50701 DROP FUNCTION IF EXISTS %s */;\n", + row[0]); } fprintf(md_result_file, "CREATE %s%sFUNCTION %s%s RETURNS %s SONAME '%s';\n", @@ -4538,12 +4579,12 @@ static int dump_all_udf() } mysql_free_result(tableres); - return 0; + return result; } /* - dump all plugins + dump all servers */ static int dump_all_servers() @@ -4583,7 +4624,7 @@ static int dump_all_servers() /* - dump all system statitical tables + dump all system statistical tables */ static int dump_all_stats() @@ -6662,14 +6703,14 @@ int main(int argc, char **argv) } } - if (opt_system & OPT_SYSTEM_PLUGIN) + if (opt_system & OPT_SYSTEM_PLUGINS) dump_all_plugins(); - if (opt_system & OPT_SYSTEM_USER) - dump_all_users(); + if (opt_system & OPT_SYSTEM_USERS) + dump_all_users_roles_and_grants(); - if (opt_system & OPT_SYSTEM_UDF) - dump_all_udf(); + if (opt_system & OPT_SYSTEM_UDFS) + dump_all_udfs(); if (opt_system & OPT_SYSTEM_SERVERS) dump_all_servers(); diff --git a/man/mysqldump.1 b/man/mysqldump.1 index 7594703d20a1f..f66c43052690c 100644 --- a/man/mysqldump.1 +++ b/man/mysqldump.1 @@ -36,7 +36,7 @@ tables, consider using the instead because it can accomplish faster backups and faster restores\&. See \fBmysqlhotcopy\fR(1)\&. .PP -There are three general ways to invoke +There are four general ways to invoke \fBmysqldump\fR: .sp .if n \{\ @@ -46,6 +46,7 @@ There are three general ways to invoke shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR +shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-system={options}\fR .fi .if n \{\ .RE diff --git a/mysql-test/r/mysqldump-system,win.rdiff b/mysql-test/r/mysqldump-system,win.rdiff index fb9756d23cde7..a99dc37e47d7f 100644 --- a/mysql-test/r/mysqldump-system,win.rdiff +++ b/mysql-test/r/mysqldump-system,win.rdiff @@ -1,3 +1,5 @@ +diff --git a/mysql-test/r/mysqldump-system.result b/mysql-test/r/mysqldump-system.result +index 88cf950c621..5f8b579fa67 100644 --- a/mysql-test/r/mysqldump-system.result +++ b/mysql-test/r/mysqldump-system.result @@ -7,8 +7,6 @@ @@ -9,7 +11,7 @@ CREATE ROLE role_1; CREATE ROLE role_2 WITH ADMIN role_1; GRANT SHOW DATABASES ON *.* TO role_1; -@@ -47,9 +45,8 @@ +@@ -48,9 +46,8 @@ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; @@ -20,7 +22,7 @@ SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; GRANT mariadb_dump_import_role TO CURRENT_USER(); -@@ -67,7 +64,7 @@ +@@ -68,7 +65,7 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; GRANT role_1 TO 'USER'@'%'; GRANT role_2 TO 'USER'@'%'; @@ -28,21 +30,26 @@ +GRANT USAGE ON *.* TO 'USER'@'%'; /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; - GRANT USAGE ON *.* TO 'role_2'; -@@ -167,11 +164,10 @@ + GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +@@ -168,8 +165,6 @@ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +-/*M!100401 UNINSTALL PLUGIN IF EXIST unix_socket */; -INSTALL PLUGIN unix_socket SONAME 'auth_socket.so'; - /*!50701 DROP USER IF EXISTS 'root'@'localhost' */; - CREATE /*M!100103 OR REPLACE */ USER 'root'@'localhost'; + DELIMITER | + /*M!100101 IF current_user()="'root'@'localhost'" THEN + SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''"; +@@ -183,7 +178,7 @@ + END IF */| + DELIMITER ; /*!50701 DROP USER IF EXISTS 'USER'@'%' */; -CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%' IDENTIFIED VIA unix_socket; +CREATE /*M!100103 OR REPLACE */ USER 'USER'@'%'; SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; GRANT mariadb_dump_import_role TO CURRENT_USER(); -@@ -191,7 +187,7 @@ +@@ -203,7 +198,7 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; GRANT role_1 TO 'USER'@'%'; GRANT role_2 TO 'USER'@'%'; @@ -50,19 +57,19 @@ +GRANT USAGE ON *.* TO 'USER'@'%'; /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; - GRANT USAGE ON *.* TO 'role_2'; -@@ -291,9 +287,8 @@ + GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +@@ -304,9 +299,8 @@ /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; --INSTALL PLUGIN unix_socket /*!100401 IF NOT EXISTS */ SONAME 'auth_socket.so'; +-INSTALL PLUGIN unix_socket /*M!100401 IF NOT EXISTS */ SONAME 'auth_socket.so'; CREATE USER IF NOT EXISTS 'root'@'localhost'; -CREATE USER IF NOT EXISTS 'USER'@'%' IDENTIFIED VIA unix_socket; +CREATE USER IF NOT EXISTS 'USER'@'%'; SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role; CREATE ROLE IF NOT EXISTS mariadb_dump_import_role; GRANT mariadb_dump_import_role TO CURRENT_USER(); -@@ -311,7 +306,7 @@ +@@ -324,7 +318,7 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION; /*!80001 ALTER USER 'root'@'localhost' DEFAULT ROLE NONE */; GRANT role_1 TO 'USER'@'%'; GRANT role_2 TO 'USER'@'%'; @@ -70,8 +77,8 @@ +GRANT USAGE ON *.* TO 'USER'@'%'; /*M!100005 SET DEFAULT ROLE 'role_2' FOR 'USER'@'%' */; /*!80001 ALTER USER 'USER'@'%' DEFAULT ROLE 'role_2' */; - GRANT USAGE ON *.* TO 'role_2'; -@@ -400,12 +395,12 @@ + GRANT role_2 TO 'role_1' WITH ADMIN OPTION; +@@ -413,12 +407,12 @@ CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; Table Checksum @@ -87,7 +94,7 @@ mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 # Opps.... -@@ -429,12 +424,12 @@ +@@ -442,12 +436,12 @@ CHECKSUM TABLE mysql.user, mysql.roles_mapping, mysql.time_zone_transition, mysql.plugin, mysql.servers, mysql.func, mysql.innodb_table_stats, mysql.table_stats; Table Checksum @@ -103,7 +110,7 @@ mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 DROP FUNCTION IF EXISTS metaphon; -@@ -448,7 +443,6 @@ +@@ -461,7 +455,6 @@ DROP ROLE role_2; DROP ROLE role_1; drop user USER; diff --git a/mysql-test/r/mysqldump-system.result b/mysql-test/r/mysqldump-system.result index 8c83164c25bfe..88cf950c6214f 100644 --- a/mysql-test/r/mysqldump-system.result +++ b/mysql-test/r/mysqldump-system.result @@ -168,6 +168,7 @@ UNLOCK TABLES; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +/*M!100401 UNINSTALL PLUGIN IF EXIST unix_socket */; INSTALL PLUGIN unix_socket SONAME 'auth_socket.so'; DELIMITER | /*M!100101 IF current_user()="'root'@'localhost'" THEN @@ -212,6 +213,7 @@ GRANT USAGE ON *.* TO 'role_2'; SET ROLE NONE; DROP ROLE mariadb_dump_import_role; /*M!100203 EXECUTE IMMEDIATE CONCAT('SET ROLE ', @current_role) */; +/*!50701 DROP FUNCTION IF EXISTS metaphon */; CREATE /*M!100103 OR REPLACE */ FUNCTION metaphon RETURNS STRING SONAME 'UDF_EXAMPLE_LIB'; CREATE /*M!100103 OR REPLACE */ SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS (Host 'localhost', Port 3306); @@ -302,7 +304,7 @@ UNLOCK TABLES; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -INSTALL PLUGIN unix_socket /*!100401 IF NOT EXISTS */ SONAME 'auth_socket.so'; +INSTALL PLUGIN unix_socket /*M!100401 IF NOT EXISTS */ SONAME 'auth_socket.so'; CREATE USER IF NOT EXISTS 'root'@'localhost'; CREATE USER IF NOT EXISTS 'USER'@'%' IDENTIFIED VIA unix_socket; SELECT COALESCE(CURRENT_ROLE(),'NONE') into @current_role;