Databases Reference
In-Depth Information
Linux and Mac OS X
For 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 see the 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 in set (0.00 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 ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
1 row in set (0.01 sec)
mysql>
SHOW GRANTS for 'root'@'ruttle.invyhome.com';
+-------------------------------------------------------------------------------+
| Grants for root@ruttle.invyhome.com |
+-------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'ruttle.invyhome.com' WITH GRANT OPTION |
+-------------------------------------------------------------------------------+
1 row in set (0.00 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 IP
address 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 ON *.* TO ''@'localhost' |
+--------------------------------------+