diff --git a/include/mysqld_error.h b/include/mysqld_error.h index 80cfed9e338..fbf89bdb3e1 100644 --- a/include/mysqld_error.h +++ b/include/mysqld_error.h @@ -305,4 +305,5 @@ #define ER_WARN_DEPRECATED_SYNTAX 1286 #define ER_NON_UPDATABLE_TABLE 1287 #define ER_FEATURE_DISABLED 1288 -#define ER_ERROR_MESSAGES 289 +#define ER_SKIP_GRANT_TABLES 1289 +#define ER_ERROR_MESSAGES 290 diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index 16c04fc7656..917b2259e24 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -301,3 +301,4 @@ character-set=latin2 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index 99470e1a32c..591e007f5a6 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -295,3 +295,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index 0b4a8139e57..3a0d77187bf 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -303,3 +303,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index 0f9d9fc1144..38ca4966dfe 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -291,4 +291,5 @@ character-set=latin1 "Unknown table engine '%s'", "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", -"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"The '%s' feature was disabled. You need MySQL built with '%s' define to have it working", +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index a54bc435fc1..f0882d5602b 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -297,3 +297,4 @@ character-set=latin7 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index accf5913ce2..d3c7c3ebde1 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -292,3 +292,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index 79b8ad5fe64..48eff8831d5 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -304,3 +304,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index 09928aed242..1e3c436e3d0 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -292,3 +292,4 @@ character-set=greek "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index b7491154815..402933d7ef7 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin2 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 829428f2fd4..d9be6ebb32d 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -292,3 +292,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 2acd11a399e..cc36dd60e85 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -294,3 +294,4 @@ character-set=ujis "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index 0533f52fc12..0bbea735a09 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -292,3 +292,4 @@ character-set=euckr "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index bb6b5b8cb11..2372e7a9690 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index b8a678d9b64..f946e988fb0 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 04cf28915b5..c6bb914d38c 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -296,3 +296,4 @@ character-set=latin2 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 16620380603..537162fc1d0 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -293,3 +293,4 @@ character-set=latin1 "'%s' И desatualizado. Use '%s' em seu lugar.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 6ccccd95417..8da92d48883 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -296,3 +296,4 @@ character-set=latin2 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index c5d06722cd8..d5d91deb280 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -294,3 +294,4 @@ character-set=koi8r "'%s' is deprecated. Use '%s' instead.", "Таблица %-.100s в %s не может изменятся.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index c47c7b66e5a..8fa7933b871 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -287,3 +287,4 @@ character-set=cp1250 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 8820b36b746..90fbe450bb1 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -300,3 +300,4 @@ character-set=latin2 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index a17d58c2d35..644a5c7a515 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index f9f05c7e122..22a6cecd773 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -292,3 +292,4 @@ character-set=latin1 "'%s' is deprecated. Use '%s' instead.", "The target table %-.100s of the %s is not updatable.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index 255083529c3..2d4ce67e2e5 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -297,3 +297,4 @@ character-set=koi8u "'%s' is deprecated. Use '%s' instead.", "Таблиця %-.100s у %s не може оновлюватись.", "The '%s' feature was disabled. You need MySQL built with '%s' define to have it working" +"MySQL is started in --skip-grant-tables mode. You can't use this command" diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 282a9afa038..77131a37869 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1114,8 +1114,8 @@ bool check_change_password(THD *thd, const char *host, const char *user) { if (!initialized) { - send_error(thd, ER_PASSWORD_NOT_ALLOWED); /* purecov: inspected */ - return(1); /* purecov: inspected */ + send_error(thd, ER_SKIP_GRANT_TABLES); /* purecov: inspected */ + return(1); /* purecov: inspected */ } if (!thd->slave_thread && (strcmp(thd->user,user) || @@ -1590,8 +1590,14 @@ static int replace_db_table(TABLE *table, const char *db, char what= (revoke_grant) ? 'N' : 'Y'; DBUG_ENTER("replace_db_table"); + if (!initialized) + { + my_error(ER_SKIP_GRANT_TABLES, MYF(0)); + DBUG_RETURN(-1); + } + /* Check if there is such a user in user table in memory? */ - if (!initialized || !find_acl_user(combo.host.str,combo.user.str)) + if (!find_acl_user(combo.host.str,combo.user.str)) { my_error(ER_PASSWORD_NO_MATCH,MYF(0)); DBUG_RETURN(-1); @@ -2167,7 +2173,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list, if (!initialized) { - send_error(thd, ER_UNKNOWN_COM_ERROR); /* purecov: inspected */ + send_error(thd, ER_SKIP_GRANT_TABLES); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */ } if (rights & ~TABLE_ACLS) @@ -2377,8 +2383,8 @@ int mysql_grant(THD *thd, const char *db, List &list, DBUG_ENTER("mysql_grant"); if (!initialized) { - my_error(ER_UNKNOWN_COM_ERROR, MYF(0)); /* purecov: tested */ - return -1; /* purecov: tested */ + my_error(ER_SKIP_GRANT_TABLES, MYF(0)); /* purecov: tested */ + DBUG_RETURN(-1); /* purecov: tested */ } if (lower_case_table_names && db) @@ -2982,8 +2988,8 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) LINT_INIT(acl_user); if (!initialized) { - send_error(thd, ER_UNKNOWN_COM_ERROR); - DBUG_RETURN(-1); + send_error(thd, ER_SKIP_GRANT_TABLES); + DBUG_RETURN(1); } if (lex_user->host.length > HOSTNAME_LENGTH || lex_user->user.length > USERNAME_LENGTH) @@ -3335,7 +3341,7 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables) if (!initialized) { - send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES)); + send_error(thd, ER_SKIP_GRANT_TABLES); DBUG_RETURN(-1); } @@ -3416,7 +3422,7 @@ int mysql_drop_user(THD *thd, List &list) DBUG_ENTER("mysql_drop_user"); if ((result= open_grant_tables(thd, tables))) - DBUG_RETURN(result == 1 ? 0 : -1); + DBUG_RETURN(result == 1 ? 0 : 1); rw_wrlock(&LOCK_grant); VOID(pthread_mutex_lock(&acl_cache->lock)); @@ -3529,7 +3535,7 @@ int mysql_revoke_all(THD *thd, List &list) DBUG_ENTER("mysql_revoke_all"); if ((result= open_grant_tables(thd, tables))) - DBUG_RETURN(result == 1 ? 0 : -1); + DBUG_RETURN(result == 1 ? 0 : 1); rw_wrlock(&LOCK_grant); VOID(pthread_mutex_lock(&acl_cache->lock));