Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13486

Make mysql_install_db create a real ''@'%' anonymous account for the test database

Details

    Description

      Currently, mysql_install_db provides default access to the test database by inserting some rows into the mysql.db table for the ''@'%' user account, but it does not insert any rows into the mysql.user table for that user account. For example:

      MariaDB [(none)]> SELECT * FROM mysql.user WHERE User='' AND Host='%'\G
      Empty set (0.00 sec)
       
      MariaDB [(none)]> SELECT * FROM mysql.db WHERE User='' AND Host='%'\G
      *************************** 1. row ***************************
                       Host: %
                         Db: test
                       User:
                Select_priv: Y
                Insert_priv: Y
                Update_priv: Y
                Delete_priv: Y
                Create_priv: Y
                  Drop_priv: Y
                 Grant_priv: N
            References_priv: Y
                 Index_priv: Y
                 Alter_priv: Y
      Create_tmp_table_priv: Y
           Lock_tables_priv: Y
           Create_view_priv: Y
             Show_view_priv: Y
        Create_routine_priv: Y
         Alter_routine_priv: N
               Execute_priv: N
                 Event_priv: Y
               Trigger_priv: Y
      *************************** 2. row ***************************
                       Host: %
                         Db: test\_%
                       User:
                Select_priv: Y
                Insert_priv: Y
                Update_priv: Y
                Delete_priv: Y
                Create_priv: Y
                  Drop_priv: Y
                 Grant_priv: N
            References_priv: Y
                 Index_priv: Y
                 Alter_priv: Y
      Create_tmp_table_priv: Y
           Lock_tables_priv: Y
           Create_view_priv: Y
             Show_view_priv: Y
        Create_routine_priv: Y
         Alter_routine_priv: N
               Execute_priv: N
                 Event_priv: Y
               Trigger_priv: Y
      2 rows in set (0.00 sec)
      

      These rows are currently inserted by the scripts/mysql_test_db.sql script:

      https://github.com/MariaDB/server/blob/mariadb-10.4.8/scripts/mysql_test_db.sql#L18

      This behavior is apparently an artifact of MySQL 3.22, which implemented privileges prior to the implementation of the GRANT statement.

      The effect of this is that mysql_install_db creates privileges for the ''@'%' user account, but the user account doesn't really exist from the perspective of other DCL statements like GRANT, CREATE USER, ALTER USER, and DROP USER.

      If someone tries to actually create a ''@'%' user account, then they will see errors that are difficult to interpret. For example:

      MariaDB [(none)]> CREATE USER ''@'%';
      ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
      

      We should probably fix scripts/mysql_test_db.sql, so that it creates a row in the mysql.user table for the ''@'%' user account.

      For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

      DELETE FROM mysql.db WHERE User='' AND Host='%';
      FLUSH PRIVILEGES;
      

      And then the account can be created:

      MariaDB [(none)]> CREATE USER ''@'%';
      Query OK, 0 rows affected (0.01 sec)
      

      This is documented here:

      https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account

      Attachments

        Issue Links

          Activity

            GeoffMontee Geoff Montee (Inactive) created issue -
            GeoffMontee Geoff Montee (Inactive) made changes -
            Field Original Value New Value
            Description It seems that MySQL and MariaDB reject some anonymous accounts that use wildcards in the host name portion of the account name, but this limitation does not seem to be documented on any of the following pages:

            https://mariadb.com/kb/en/mariadb/create-user/#account-names

            https://mariadb.com/kb/en/mariadb/grant/

            Example:

            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            MariaDB [(none)]> CREATE USER ''@'192.168.1.%';
            Query OK, 0 rows affected (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%.mysql.com';
            Query OK, 0 rows affected (0.02 sec)

            If this is a feature, then we should probably document it. If it is a bug, then we should probably fix it.

            Relevant upstream bug:

            https://bugs.mysql.com/bug.php?id=87363
            It seems that MySQL and MariaDB reject some anonymous accounts that use wildcards in the host name portion of the account name, but this limitation does not seem to be documented on any of the following pages:

            https://mariadb.com/kb/en/mariadb/create-user/#account-names

            https://mariadb.com/kb/en/mariadb/grant/

            Example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            MariaDB [(none)]> CREATE USER ''@'192.168.1.%';
            Query OK, 0 rows affected (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%.mysql.com';
            Query OK, 0 rows affected (0.02 sec)
            {noformat}

            If this is a feature, then we should probably document it. If it is a bug, then we should probably fix it.

            Relevant upstream bug:

            https://bugs.mysql.com/bug.php?id=87363
            serg Sergei Golubchik made changes -
            Labels documentation privileges privileges
            serg Sergei Golubchik made changes -
            Component/s Documentation [ 10903 ]
            serg Sergei Golubchik made changes -
            Affects Version/s 5.5 [ 15800 ]
            Affects Version/s 10.0 [ 16000 ]
            Affects Version/s 10.1 [ 16100 ]
            Affects Version/s 10.2 [ 14601 ]
            Affects Version/s 10.0.31 [ 22501 ]
            Affects Version/s 10.1.25 [ 22542 ]
            Affects Version/s 10.2.7 [ 22543 ]
            serg Sergei Golubchik made changes -
            Assignee Ian Gilfillan [ greenman ]
            serg Sergei Golubchik made changes -
            Priority Major [ 3 ] Minor [ 4 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.2 [ 14601 ]
            serg Sergei Golubchik made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            Summary Document limitations regarding anonymous accounts that use wildcards Make mysql_install_db create a real anonymous accounts for the test database
            GeoffMontee Geoff Montee (Inactive) made changes -
            Description It seems that MySQL and MariaDB reject some anonymous accounts that use wildcards in the host name portion of the account name, but this limitation does not seem to be documented on any of the following pages:

            https://mariadb.com/kb/en/mariadb/create-user/#account-names

            https://mariadb.com/kb/en/mariadb/grant/

            Example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            MariaDB [(none)]> CREATE USER ''@'192.168.1.%';
            Query OK, 0 rows affected (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%.mysql.com';
            Query OK, 0 rows affected (0.02 sec)
            {noformat}

            If this is a feature, then we should probably document it. If it is a bug, then we should probably fix it.

            Relevant upstream bug:

            https://bugs.mysql.com/bug.php?id=87363
            mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in ''@'%' mysql.user for the user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#anonymous-accounts

            Relevant upstream bug:

            https://bugs.mysql.com/bug.php?id=87363
            GeoffMontee Geoff Montee (Inactive) made changes -
            Summary Make mysql_install_db create a real anonymous accounts for the test database Make mysql_install_db create a real ''@'%' anonymous account for the test database
            GeoffMontee Geoff Montee (Inactive) made changes -
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.2 [ 14601 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            Assignee Sergei Golubchik [ serg ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            Component/s Scripts & Clients [ 11002 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            Description mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in ''@'%' mysql.user for the user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#anonymous-accounts

            Relevant upstream bug:

            https://bugs.mysql.com/bug.php?id=87363
            mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in ''@'%' mysql.user for the user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#anonymous-accounts
            GeoffMontee Geoff Montee (Inactive) made changes -
            Description mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in ''@'%' mysql.user for the user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#anonymous-accounts
            mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in ''@'%' mysql.user for the user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            GeoffMontee Geoff Montee (Inactive) made changes -
            Description mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in ''@'%' mysql.user for the user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in mysql.user for the ''@'%' user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            GeoffMontee Geoff Montee (Inactive) made changes -
            serg Sergei Golubchik made changes -
            serg Sergei Golubchik made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.4 [ 22408 ]
            GeoffMontee Geoff Montee (Inactive) made changes -
            Description mysql_install_db only partially creates a ''@'%' user when setting up the test database. This causes errors that are difficult to interpret when someone tries to actually create a ''@'%' user. For example:

            {noformat}
            MariaDB [(none)]> SELECT VERSION();
            +-----------------+
            | VERSION() |
            +-----------------+
            | 10.1.25-MariaDB |
            +-----------------+
            1 row in set (0.00 sec)

            MariaDB [(none)]> SELECT User, Host FROM mysql.user WHERE User='';
            Empty set (0.00 sec)

            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            The root cause of the problem is that scripts/mysql_test_db.sql inserts some rows into mysql.db for the ''@'%' user, but it does not also insert a row into mysql.user for the user:

            https://github.com/MariaDB/server/blob/4abb8216a054e14afbeb81e8529e02bab6fa14ac/scripts/mysql_test_db.sql

            We should probably fix scripts/mysql_test_db.sql, so that it creates a row in mysql.user for the ''@'%' user.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            Currently, {{mysql_install_db}} inserts some rows into the {{mysql.db}} table for the {{''@'%'}} user account, but it does not insert any rows into the {{mysql.user}} table for that user account. For example:

            {noformat}
            MariaDB [(none)]> SELECT * FROM mysql.user WHERE User='' AND Host='%'\G
            Empty set (0.00 sec)

            MariaDB [(none)]> SELECT * FROM mysql.db WHERE User='' AND Host='%'\G
            *************************** 1. row ***************************
                             Host: %
                               Db: test
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            *************************** 2. row ***************************
                             Host: %
                               Db: test\_%
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            2 rows in set (0.00 sec)
            {noformat}

            These rows are currently inserted by the {{scripts/mysql_test_db.sql}} script:

            https://github.com/MariaDB/server/blob/mariadb-10.4.8/scripts/mysql_test_db.sql#L18

            This behavior is apparently an artifact of MySQL 3.22, which implemented privileges prior to the implementation of the {{GRANT}} statement.

            The effect of this is that {{mysql_install_db}} creates privileges for the {{''@'%'}} user account, but the user account doesn't really exist from the perspective of other DCL statements like {{GRANT}}, {{CREATE USER}}, {{ALTER USER}}, and {{DROP USER}}.

            If someone tries to actually create a {{''@'%'}} user account, then they will see errors that are difficult to interpret. For example:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            We should probably fix {{scripts/mysql_test_db.sql}}, so that it creates a row in the {{mysql.user}} table for the {{''@'%'}} user account.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            GeoffMontee Geoff Montee (Inactive) made changes -
            Description Currently, {{mysql_install_db}} inserts some rows into the {{mysql.db}} table for the {{''@'%'}} user account, but it does not insert any rows into the {{mysql.user}} table for that user account. For example:

            {noformat}
            MariaDB [(none)]> SELECT * FROM mysql.user WHERE User='' AND Host='%'\G
            Empty set (0.00 sec)

            MariaDB [(none)]> SELECT * FROM mysql.db WHERE User='' AND Host='%'\G
            *************************** 1. row ***************************
                             Host: %
                               Db: test
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            *************************** 2. row ***************************
                             Host: %
                               Db: test\_%
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            2 rows in set (0.00 sec)
            {noformat}

            These rows are currently inserted by the {{scripts/mysql_test_db.sql}} script:

            https://github.com/MariaDB/server/blob/mariadb-10.4.8/scripts/mysql_test_db.sql#L18

            This behavior is apparently an artifact of MySQL 3.22, which implemented privileges prior to the implementation of the {{GRANT}} statement.

            The effect of this is that {{mysql_install_db}} creates privileges for the {{''@'%'}} user account, but the user account doesn't really exist from the perspective of other DCL statements like {{GRANT}}, {{CREATE USER}}, {{ALTER USER}}, and {{DROP USER}}.

            If someone tries to actually create a {{''@'%'}} user account, then they will see errors that are difficult to interpret. For example:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            We should probably fix {{scripts/mysql_test_db.sql}}, so that it creates a row in the {{mysql.user}} table for the {{''@'%'}} user account.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            Currently, {{mysql_install_db}} provides default access to the test database by inserting some rows into the {{mysql.db}} table for the {{''@'%'}} user account, but it does not insert any rows into the {{mysql.user}} table for that user account. For example:

            {noformat}
            MariaDB [(none)]> SELECT * FROM mysql.user WHERE User='' AND Host='%'\G
            Empty set (0.00 sec)

            MariaDB [(none)]> SELECT * FROM mysql.db WHERE User='' AND Host='%'\G
            *************************** 1. row ***************************
                             Host: %
                               Db: test
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            *************************** 2. row ***************************
                             Host: %
                               Db: test\_%
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            2 rows in set (0.00 sec)
            {noformat}

            These rows are currently inserted by the {{scripts/mysql_test_db.sql}} script:

            https://github.com/MariaDB/server/blob/mariadb-10.4.8/scripts/mysql_test_db.sql#L18

            This behavior is apparently an artifact of MySQL 3.22, which implemented privileges prior to the implementation of the {{GRANT}} statement.

            The effect of this is that {{mysql_install_db}} creates privileges for the {{''@'%'}} user account, but the user account doesn't really exist from the perspective of other DCL statements like {{GRANT}}, {{CREATE USER}}, {{ALTER USER}}, and {{DROP USER}}.

            If someone tries to actually create a {{''@'%'}} user account, then they will see errors that are difficult to interpret. For example:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            We should probably fix {{scripts/mysql_test_db.sql}}, so that it creates a row in the {{mysql.user}} table for the {{''@'%'}} user account.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            GeoffMontee Geoff Montee (Inactive) made changes -
            Description Currently, {{mysql_install_db}} provides default access to the test database by inserting some rows into the {{mysql.db}} table for the {{''@'%'}} user account, but it does not insert any rows into the {{mysql.user}} table for that user account. For example:

            {noformat}
            MariaDB [(none)]> SELECT * FROM mysql.user WHERE User='' AND Host='%'\G
            Empty set (0.00 sec)

            MariaDB [(none)]> SELECT * FROM mysql.db WHERE User='' AND Host='%'\G
            *************************** 1. row ***************************
                             Host: %
                               Db: test
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            *************************** 2. row ***************************
                             Host: %
                               Db: test\_%
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            2 rows in set (0.00 sec)
            {noformat}

            These rows are currently inserted by the {{scripts/mysql_test_db.sql}} script:

            https://github.com/MariaDB/server/blob/mariadb-10.4.8/scripts/mysql_test_db.sql#L18

            This behavior is apparently an artifact of MySQL 3.22, which implemented privileges prior to the implementation of the {{GRANT}} statement.

            The effect of this is that {{mysql_install_db}} creates privileges for the {{''@'%'}} user account, but the user account doesn't really exist from the perspective of other DCL statements like {{GRANT}}, {{CREATE USER}}, {{ALTER USER}}, and {{DROP USER}}.

            If someone tries to actually create a {{''@'%'}} user account, then they will see errors that are difficult to interpret. For example:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            We should probably fix {{scripts/mysql_test_db.sql}}, so that it creates a row in the {{mysql.user}} table for the {{''@'%'}} user account.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            Currently, {{mysql_install_db}} provides default access to the {{test}} database by inserting some rows into the {{mysql.db}} table for the {{''@'%'}} user account, but it does not insert any rows into the {{mysql.user}} table for that user account. For example:

            {noformat}
            MariaDB [(none)]> SELECT * FROM mysql.user WHERE User='' AND Host='%'\G
            Empty set (0.00 sec)

            MariaDB [(none)]> SELECT * FROM mysql.db WHERE User='' AND Host='%'\G
            *************************** 1. row ***************************
                             Host: %
                               Db: test
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            *************************** 2. row ***************************
                             Host: %
                               Db: test\_%
                             User:
                      Select_priv: Y
                      Insert_priv: Y
                      Update_priv: Y
                      Delete_priv: Y
                      Create_priv: Y
                        Drop_priv: Y
                       Grant_priv: N
                  References_priv: Y
                       Index_priv: Y
                       Alter_priv: Y
            Create_tmp_table_priv: Y
                 Lock_tables_priv: Y
                 Create_view_priv: Y
                   Show_view_priv: Y
              Create_routine_priv: Y
               Alter_routine_priv: N
                     Execute_priv: N
                       Event_priv: Y
                     Trigger_priv: Y
            2 rows in set (0.00 sec)
            {noformat}

            These rows are currently inserted by the {{scripts/mysql_test_db.sql}} script:

            https://github.com/MariaDB/server/blob/mariadb-10.4.8/scripts/mysql_test_db.sql#L18

            This behavior is apparently an artifact of MySQL 3.22, which implemented privileges prior to the implementation of the {{GRANT}} statement.

            The effect of this is that {{mysql_install_db}} creates privileges for the {{''@'%'}} user account, but the user account doesn't really exist from the perspective of other DCL statements like {{GRANT}}, {{CREATE USER}}, {{ALTER USER}}, and {{DROP USER}}.

            If someone tries to actually create a {{''@'%'}} user account, then they will see errors that are difficult to interpret. For example:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            ERROR 1396 (HY000): Operation CREATE USER failed for ''@'%'
            {noformat}

            We should probably fix {{scripts/mysql_test_db.sql}}, so that it creates a row in the {{mysql.user}} table for the {{''@'%'}} user account.

            For now, this can be worked around by deleting the row in the mysql.db table and then executing FLUSH PRIVILEGES. For example:

            {noformat}
            DELETE FROM mysql.db WHERE User='' AND Host='%';
            FLUSH PRIVILEGES;
            {noformat}

            And then the account can be created:

            {noformat}
            MariaDB [(none)]> CREATE USER ''@'%';
            Query OK, 0 rows affected (0.01 sec)
            {noformat}

            This is documented here:

            https://mariadb.com/kb/en/library/create-user/#fixing-a-legacy-default-anonymous-account
            GeoffMontee Geoff Montee (Inactive) made changes -
            GeoffMontee Geoff Montee (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Affects Version/s 10.2 [ 14601 ]
            Affects Version/s 5.5 [ 15800 ]
            Affects Version/s 10.0 [ 16000 ]
            Affects Version/s 10.1 [ 16100 ]
            Affects Version/s 10.3 [ 22126 ]
            Affects Version/s 10.4 [ 22408 ]
            Issue Type Bug [ 1 ] Task [ 3 ]
            ralf.gebhardt Ralf Gebhardt made changes -
            Fix Version/s 10.5 [ 23123 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 81979 ] MariaDB v4 [ 131796 ]
            julien.fritsch Julien Fritsch made changes -
            Priority Minor [ 4 ] Major [ 3 ]
            serg Sergei Golubchik made changes -
            Fix Version/s N/A [ 14700 ]
            Resolution Won't Fix [ 2 ]
            Status Confirmed [ 10101 ] Closed [ 6 ]

            People

              serg Sergei Golubchik
              GeoffMontee Geoff Montee (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.