1 row inset sec)
mysql>
SHOW GRANTS for ''@'ruttle.invyhome.com';+------------------------------------------------+
| Grants for @hugh.local |
+------------------------------------------------+
| GRANT USAGE ONTO ''@'ruttle.invyhome.com' |
+------------------------------------------------+
1 row inset sec)
The anonymous user also has permission to access the test database and
databases beginning with test, effectively as though you’d executed these statements:
mysql>
GRANT ALL ON test TO ''@'%';Query OK, 0 rows affected (0.00 sec)
mysql>
GRANT ALL ON test TO ''@'%';Query OK, 0 rows affected (0.06 sec)
Note that we’ve used backtick symbols (
`
) on the second line to enclose the table
name to prevent the backslash,
underscore, and percentage symbols from confusing MySQL.
You can verify that these privileges are in effect by running a SELECT * FROM db;
query.
However, you can’t explore these privileges
with the SHOW GRANTSstatement because there’s no matching user ''@'%'
. It would be more secure for the default installation to grant privileges for the test databases to only the local anonymous users ''@'localhost'
and ''@'ruttle.invyhome.com'
, rather than to ''@'%'
WindowsCurrent versions of MySQL for Windows come with only the root user defined. You can allow anonymous access by asking the MySQL Windows installer program to create anonymous users. Again, we recommend that you don’t do this.
The root user has permission to access the server only from the localhost machine:
mysql>
SELECT User,Host from mysql.user;+------+-----------+
| User | Host |
+------+-----------+
| root | localhost |
+------+-----------+
1 row inset sec)
When
the MySQL server is installed, the root user is automatically
created with the following GRANT
statements:
mysql>
SHOW GRANTS for 'root'@'localhost';+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ONTO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
1 row inset sec)
Share with your friends: