Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
In a production MySQL deployment, allowing applications, developers, or microservices to connect as the root superuser is an immense security hazard. Secure database administration mandates creating dedicated user accounts adhering to the Principle of Least Privilege.
In MySQL, a user identity consists of two distinct components: the Username and the Host:
The host portion dictates from which physical network address or domain the user is allowed to connect:
'app_user'@'localhost': Allowed to connect only from the local machine hosting MySQL (via local UNIX socket or 127.0.0.1).'app_user'@'192.168.1.50': Allowed to connect only from this specific IP address.'app_user'@'10.0.%.%': Allowed to connect from any IP within the 10.0.0.0/16 subnet.'app_user'@'%': Allowed to connect from any host across the network/internet.'admin'@'localhost' and 'admin'@'%' are treated by MySQL as two entirely separate accounts with independent passwords and privileges!Starting in MySQL 8.0, the default authentication plugin is caching_sha2_password, providing SHA-256 password hashing and secure RSA key-pair exchanges.
If an older legacy application driver (e.g., an outdated PHP 5.6 or Python 2 client) fails to connect, you can specify the legacy plugin:
All user accounts are stored in the user table of the system mysql database:
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Transaction Isolation Levels in MySQL | Granting Privileges (GRANT Statement) |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.