Introduction
In this project, you will learn how to retrieve and view the user permission information from the MySQL database. This project is designed to help you understand the MySQL user management and permission system, which is an essential skill for database administrators and developers.
👀 Preview

🎯 Tasks
In this project, you will learn:
- How to access the MySQL database using the
sudocommand without a password - How to switch to the
mysqldatabase - How to query the permission information for a specific user, in this case, the
rootuser
🏆 Achievements
After completing this project, you will be able to:
- Understand the MySQL user management and permission system
- Retrieve and view the permission information for a specific user
- Apply the knowledge to manage user permissions in your own MySQL database projects
Access MySQL and Switch to the MySQL Database
In this step, you will learn how to access the MySQL database using the sudo command without any password, and switch to the mysql database.
- Start the MySQL service:
sudo service mysql start
- Access the MySQL database using the
sudocommand:
sudo mysql
- Switch to the
mysqldatabase:
USE mysql;
Query the Permission Information for the Root User
In this step, you will learn how to query the permission information for the root user with modify privileges.
- Open the
showGrant.sqlfile and add the following SQL statement:
SELECT * FROM user WHERE User = 'root' AND Host = 'localhost';
- Save the
showGrant.sqlfile. - Run the SQL script in the MySQL prompt:
SOURCE /home/labex/project/showGrant.sql;
This will display the permission information for the root user with modify privileges.

Summary
Congratulations! You have completed this project. You can practice more labs in LabEx to improve your skills.
