Home Database Mysql Tutorial Does mysql have a user table?

Does mysql have a user table?

Feb 24, 2022 pm 06:43 PM
mysql

Mysql has a user table. The user table is a permission table in MySQL, used to record account information that is allowed to connect to the server; the fields in the user table can be roughly divided into four categories, namely user columns, permission columns, security columns and resource control columns.

Does mysql have a user table?

The operating environment of this tutorial: windows7 system, mysql5.7 version, Dell G3 computer.

mysql has a user table.

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.

The fields in the user table can be roughly divided into 4 categories, namely user columns, permission columns, security columns and resource control columns. The following mainly introduces the meaning of these fields.

User column

The user column stores the information that users need to enter when connecting to the MySQL database. It should be noted that MySQL 5.7 version no longer uses Password as the password field, but changed it to authentication_string.

The user list for MySQL version 5.7 is shown in Table 1.

Table 1: User column of user table
Field name Field type Is it empty Default value Description
Host char(60) NO None Host Name
User char(32) NO None Username
authentication_string text YES None Password

When a user logs in, the MySQL database system will only allow him or her to log in if these three fields match at the same time. When creating a new user, the values ​​of these three fields are also set. When you modify a user's password, you actually modify the value of the authentication_string field of the user table. Therefore, these 3 fields determine whether the user can log in.

Permission column

The fields in the permission column determine the user's permissions and are used to describe the permissions on data and databases that are allowed globally. operate.

Permissions are roughly divided into two categories, namely advanced management permissions and ordinary permissions:

  • Advanced management permissions mainly manage the database, such as the permission to close services, Super permissions and loading users, etc.;

  • Normal permissions mainly operate the database, such as query permissions, modification permissions, etc.

The permission columns of the user table include Select_priv, Insert_ priv and other fields ending with priv. The data type of these field values ​​is ENUM. The only possible values ​​are Y and N: Y represents the user There are corresponding permissions, N means that the user does not have the corresponding permissions. For security reasons, the default value for these fields is N.

##Select_privenum('N','Y')NONWhether it is possible to query data through the SELECT commandInsert_privenum('N','Y')NONWhether data can be inserted through the INSERT commandUpdate_privenum('N','Y' )NONCan existing data be modified through the UPDATE command?Delete_privenum ('N','Y')NONCan you delete existing data through the DELETE command?## Create_privDrop_privReload_privShutdown_privProcess_privFile_priv Grant_privReferences_privIndex_privAlter_privShow_db_privSuper_privCreate_tmp_table_privLock_tables_privExecute_privRepl_slave_privRepl_client_priv Create_view_privShow_view_privCreate_routine_privAlter_routine_privCreate_user_privEvent_privTrigger_privCreate_tablespace_priv

If you want to modify permissions, you can use the GRANT statement to grant some permissions to the user, or you can set permissions by updating the user table with the UPDATE statement.

Security column

The security column is mainly used to determine whether the user can log in successfully. The security column in the user table is shown in Table 3:

Table 2: Permission columns of user table
Field name Field type Whether it is empty Default value Description
enum('N','Y') NO N Can create new databases and tables
enum('N','Y') NO N Can I delete an existing database? and table
enum('N','Y') NO N Is it possible to execute specific commands that refresh and reload the various internal caches used by MySQL, including logs, permissions, hosts, queries, and tables
enum( 'N','Y') NO N Whether it is possible to shut down the MySQL server. Extreme caution should be exercised when providing this privilege to any user other than the root account
enum('N','Y') NO N Can I check the processes of other users through the SHOW PROCESSLIST command?
enum(' N','Y') NO N Whether it is possible to execute the SELECT INTO OUTFILE and LOAD DATA INFILE commands
enum('N','Y') NO N Can I grant my permissions to other users?
enum('N','Y') NO N Can create external Key constraints
enum('N','Y') NO N Whether it is possible to perform addition and deletion checks on the index
enum('N','Y') NO N Can the table structure be renamed and modified
enum('N','Y') NO N Is it possible to view the names of all databases on the server, including databases to which the user has sufficient access rights
enum('N','Y') NO N Whether it is possible to perform some powerful management functions, such as deleting user processes through the KILL command; use The SET GLOBAL command modifies global MySQL variables and executes various commands regarding replication and logging. (Super permission)
enum('N','Y') NO N Is it possible to create a temporary table
enum('N','Y') NO N Is it possible to use the LOCK TABLES command to prevent access/modification of tables
enum('N','Y') NO N Can the stored procedure be executed?
enum('N',' Y') NO N Is it possible to read the binary log file used to maintain a replicated database environment
enum('N','Y') NO N Is it possible to determine the location of the replication slave server and master server
enum('N','Y') NO N Can a view be created?
enum('N','Y') NO N Yes Can view view
enum('N','Y') NO N Whether stored procedures and functions can be changed or discarded
enum('N','Y') NO N Whether stored functions and functions can be modified or deleted
enum('N','Y') NO N Whether it is possible to execute the CREATE USER command, which is used to create a new MySQL account
enum('N','Y') NO #N Whether events can be created, modified and deleted
enum('N','Y') NO N Whether triggers can be created and deleted
enum('N','Y') NO N Can the table be created? space
Table 3: Security columns of user table
Field name Field type Is it empty Default value Description
ssl_type enum('','ANY','X509','SPECIFIED') NO Support ssl standard encryption security field
ssl_cipher blob NO Support ssl standard encryption security field
x509_issuer blob NO Support x509 standard fields
x509_subject blob NO Support x509 standard fields
plugin char(64) NO mysql_native_password Introduce plugins To perform password verification when users connect, the plugin creates external/proxy users
password_expired enum('N','Y') NO N Whether the password has expired (N has not expired, y has expired)
password_last_changed timestamp YES Record the time when the password was last modified
password_lifetime smallint(5) unsigned YES Set the validity time of the password in days
account_locked enum('N','Y ') NO N Whether the user is locked (Y locked, N unlocked)

Note: Even if password_expired is "Y", the user can still use the password to log in to MySQL, but no operations are allowed.

Usually standard distributions do not support ssl. Readers can use the SHOW VARIABLES LIKE "have_openssl" statement to check whether it has ssl functionality. If the value of have_openssl is DISABLED, the ssl encryption feature is not supported.

Resource control column

The fields in the resource control column are used to limit the resources used by users. The resource control columns in the user table are as shown in Table 4 shown.

Table 4: Resource control column of user table
Field name Field type Is it empty Default value Description
max_questions int(11) unsigned NO 0 Specifies the number of query operations allowed per hour
max_updates int(11) unsigned #NO 0 Specifies the number of update operations allowed per hour
max_connections int(11) unsigned NO 0 Specifies the number of connection operations allowed per hour
max_user_connections int(11) unsigned NO 0 Specifies the number of connections allowed to be established simultaneously

The default value of the above fields is 0, indicating no limit . If the number of user queries or connections exceeds the resource control limit within an hour, the user will be locked and cannot perform corresponding operations here until the next hour. The values ​​of these fields can be updated using the GRANT statement.

[Related recommendations: mysql video tutorial]

The above is the detailed content of Does mysql have a user table?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP's big data structure processing skills PHP's big data structure processing skills May 08, 2024 am 10:24 AM

Big data structure processing skills: Chunking: Break down the data set and process it in chunks to reduce memory consumption. Generator: Generate data items one by one without loading the entire data set, suitable for unlimited data sets. Streaming: Read files or query results line by line, suitable for large files or remote data. External storage: For very large data sets, store the data in a database or NoSQL.

How to optimize MySQL query performance in PHP? How to optimize MySQL query performance in PHP? Jun 03, 2024 pm 08:11 PM

MySQL query performance can be optimized by building indexes that reduce lookup time from linear complexity to logarithmic complexity. Use PreparedStatements to prevent SQL injection and improve query performance. Limit query results and reduce the amount of data processed by the server. Optimize join queries, including using appropriate join types, creating indexes, and considering using subqueries. Analyze queries to identify bottlenecks; use caching to reduce database load; optimize PHP code to minimize overhead.

How to use MySQL backup and restore in PHP? How to use MySQL backup and restore in PHP? Jun 03, 2024 pm 12:19 PM

Backing up and restoring a MySQL database in PHP can be achieved by following these steps: Back up the database: Use the mysqldump command to dump the database into a SQL file. Restore database: Use the mysql command to restore the database from SQL files.

How to insert data into a MySQL table using PHP? How to insert data into a MySQL table using PHP? Jun 02, 2024 pm 02:26 PM

How to insert data into MySQL table? Connect to the database: Use mysqli to establish a connection to the database. Prepare the SQL query: Write an INSERT statement to specify the columns and values ​​to be inserted. Execute query: Use the query() method to execute the insertion query. If successful, a confirmation message will be output.

How to fix mysql_native_password not loaded errors on MySQL 8.4 How to fix mysql_native_password not loaded errors on MySQL 8.4 Dec 09, 2024 am 11:42 AM

One of the major changes introduced in MySQL 8.4 (the latest LTS release as of 2024) is that the "MySQL Native Password" plugin is no longer enabled by default. Further, MySQL 9.0 removes this plugin completely. This change affects PHP and other app

How to use MySQL stored procedures in PHP? How to use MySQL stored procedures in PHP? Jun 02, 2024 pm 02:13 PM

To use MySQL stored procedures in PHP: Use PDO or the MySQLi extension to connect to a MySQL database. Prepare the statement to call the stored procedure. Execute the stored procedure. Process the result set (if the stored procedure returns results). Close the database connection.

How to create a MySQL table using PHP? How to create a MySQL table using PHP? Jun 04, 2024 pm 01:57 PM

Creating a MySQL table using PHP requires the following steps: Connect to the database. Create the database if it does not exist. Select a database. Create table. Execute the query. Close the connection.

The difference between oracle database and mysql The difference between oracle database and mysql May 10, 2024 am 01:54 AM

Oracle database and MySQL are both databases based on the relational model, but Oracle is superior in terms of compatibility, scalability, data types and security; while MySQL focuses on speed and flexibility and is more suitable for small to medium-sized data sets. . ① Oracle provides a wide range of data types, ② provides advanced security features, ③ is suitable for enterprise-level applications; ① MySQL supports NoSQL data types, ② has fewer security measures, and ③ is suitable for small to medium-sized applications.

See all articles