In mysql, you can use the "SELECT * FROM mysql.user;" statement to query the user table, and you must have query permissions on the user table to execute this statement. The newly created user only has the permission to log in to the MySQL server. It does not have any other permissions and cannot query the user table.
(Recommended tutorial: mysql video tutorial)
MySQL will automatically create a file named mysql during installation Database, mysql database stores user permission tables. After the user logs in, MySQL will grant corresponding permissions to each user based on the contents of these permission tables.
The user table is the most important permission table in MySQL, used to record account information allowed to connect to the server. It should be noted that all permissions enabled in the user table are global and apply to all databases.
In MySQL, you can view the corresponding user permissions by viewing the data records in the mysql.user table, or you can use the SHOW GRANTS statement to query the user's permissions.
The user table under the mysql database stores the user's basic permissions, which can be viewed using the SELECT statement. The code of the SELECT statement is as follows:
SELECT * FROM mysql.user;
To execute this statement, you must have query permissions on the user table.
Note: The newly created user only has the permission to log in to the MySQL server. It does not have any other permissions and cannot query the user table.
The above is the detailed content of How to query the mysql user table?. For more information, please follow other related articles on the PHP Chinese website!