Learning Mysql



Download 4.24 Mb.
View original pdf
Page303/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   299   300   301   302   303   304   305   306   ...   366
Learning MySQL
The Default Users | 329


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 GRANTS
statement 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 ''@'%'
Windows
Current 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)

Download 4.24 Mb.

Share with your friends:
1   ...   299   300   301   302   303   304   305   306   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page