Learning Mysql


Default User Configuration



Download 4.24 Mb.
View original pdf
Page302/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   298   299   300   301   302   303   304   305   ...   366
Learning MySQL
Default User Configuration
The default installation allows the default users to access the server, but the machines they can connect from depend on whether you’re using Windows or a Unix-like system,
such as Linux or Mac OS X. This section shows you the
GRANT
statements used to create the default users and explains what they mean in practice.
328 | Chapter 9:
Managing Users and Privileges


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 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 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 ONTO ''@'localhost' |
+--------------------------------------+

Download 4.24 Mb.

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




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

    Main page