Linux and Mac OS XFor Linux,
Mac OS X, and other Unix variants, the root user can access the server from only the
computer hosting the server, specified using the mnemonic localhost
, using the IP address 127.0.0.1, or by providing its actual IP address or hostname.
You can seethe default configuration by listing the user- and hostnames in the user table of the mysql database:
mysql>
SELECT User,Host FROM mysql.user;
+------+---------------------+
| User | Host |
+------+---------------------+
| | localhost |
| root | localhost |
| | ruttle.invyhome.com |
| root | ruttle.invyhome.com |
+------+---------------------+
4 rows 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)
mysql>
SHOW GRANTS for 'root'@'ruttle.invyhome.com';+-------------------------------------------------------------------------------+
| Grants for root@ruttle.invyhome.com |
+-------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ONTO 'root'@'ruttle.invyhome.com' WITH GRANT OPTION |
+-------------------------------------------------------------------------------+
1 row inset sec)
Here, ruttle.invyhome.com is the network name of the localhost system.
The anonymous user can access the
server from only the localhost, specified using the mnemonic localhost
, using the IP address 127.0.0.1,
or by providing the actual IPaddress or hostname of that machine. The anonymous user has default access to only the test database and those databases beginning with the string test_
When the MySQL server is installed, the anonymous user is automatically created with the following
GRANT
statements:
mysql>
SHOW GRANTS for ''@'localhost';+--------------------------------------+
| Grants for @localhost |
+--------------------------------------+
| GRANT USAGE ONTO ''@'localhost' |
+--------------------------------------+
Share with your friends: