Home Database Mysql Tutorial Where is the user table of mysql?

Where is the user table of mysql?

Nov 08, 2022 pm 06:17 PM
mysql

The user table is in the database named "mysql". MySQL will automatically create a database named "mysql" during installation. The mysql database stores user permission tables; the user table is the most important permission table in the mysql database and is used to record the accounts allowed to connect to the server. information. All permissions enabled in the user table are global and apply to all databases.

Where is the user table of mysql?

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

The user table is in the database named "mysql".

MySQL will automatically create a database named mysql during installation. The 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.

Where is the user table of mysql?Where is the user table of mysql?

Fields in the user table

The fields in the user table can be roughly divided into There are 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 operations allowed on data and databases in the global scope.

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 Load users, etc.;
  • Normal permissions mainly operate the database, such as query permissions, modify 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 means that the user has corresponding Permissions, N means that the user does not have 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 Is it 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
##ssl_typeenum('','ANY','X509','SPECIFIED')NOSupport ssl standard encryption security fieldssl_cipherblobNOSupport ssl standard encryption security fieldx509_issuerblobNOSupport x509 standard fieldsx509_subjectblobNOSupport x509 Standard fieldspluginchar(64)NOmysql_native_passwordIntroducing plugins for user Password verification when connecting, plugin creates external/proxy userpassword_expiredenum('N','Y')NONWhether the password has expired (N has not expired, y has expired)password_last_changedtimestampYES Record the time when the password was last modifiedpassword_lifetimesmallint(5) unsignedYESSet the validity time of the password in daysaccount_lockedenum('N','Y')NONWhether the user is locked (Y locked, N unlocked)
Table 3: Security columns of user table
Field name Field type Whether it is empty Default value Description
Note: Even if password_expired If it is "Y", the user can also 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 of the resource control column are used to limit the resources used by users. The resource control columns in the user table are shown in Table 4.


Table 4: Resource control columns of the user tableField nameField typeYes Is emptyDefault valueDescriptionmax_questionsint(11) unsignedNO0Specifies the number of query operations allowed per hourmax_updatesint(11) unsigned NO0Specifies the number of update operations allowed per hourmax_connectionsint(11) unsignedNO0Specifies the number of connection operations allowed per hourmax_user_connectionsint(11) unsigned NO0Specifies the number of connections allowed to be established simultaneously
The default value of the above fields is 0. Indicates 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.


How to access the user table

1. Connect to the mysql database and view all default database information

Where is the user table of mysql?

2. Because the user table exists in the mysql database, you can switch the database through the use command.

Where is the user table of mysql?

After switching the database, you can view the database through the show command. For all data tables in , you can see the user data table at the end

Where is the user table of mysql?

Where is the user table of mysql?

You can view the structural information of the user table through the desc command, because The User table contains a lot of information, so there is also a lot of structural information

Where is the user table of mysql?

#When no other users are created by default, there is only super administrator information

Where is the user table of mysql?

[Related recommendations:

mysql video tutorial]

The above is the detailed content of Where is the user table of mysql?. 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)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 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)

MySQL: The Ease of Data Management for Beginners MySQL: The Ease of Data Management for Beginners Apr 09, 2025 am 12:07 AM

MySQL is suitable for beginners because it is simple to install, powerful and easy to manage data. 1. Simple installation and configuration, suitable for a variety of operating systems. 2. Support basic operations such as creating databases and tables, inserting, querying, updating and deleting data. 3. Provide advanced functions such as JOIN operations and subqueries. 4. Performance can be improved through indexing, query optimization and table partitioning. 5. Support backup, recovery and security measures to ensure data security and consistency.

How to create navicat premium How to create navicat premium Apr 09, 2025 am 07:09 AM

Create a database using Navicat Premium: Connect to the database server and enter the connection parameters. Right-click on the server and select Create Database. Enter the name of the new database and the specified character set and collation. Connect to the new database and create the table in the Object Browser. Right-click on the table and select Insert Data to insert the data.

Can I retrieve the database password in Navicat? Can I retrieve the database password in Navicat? Apr 08, 2025 pm 09:51 PM

Navicat itself does not store the database password, and can only retrieve the encrypted password. Solution: 1. Check the password manager; 2. Check Navicat's "Remember Password" function; 3. Reset the database password; 4. Contact the database administrator.

MySQL: Simple Concepts for Easy Learning MySQL: Simple Concepts for Easy Learning Apr 10, 2025 am 09:29 AM

MySQL is an open source relational database management system. 1) Create database and tables: Use the CREATEDATABASE and CREATETABLE commands. 2) Basic operations: INSERT, UPDATE, DELETE and SELECT. 3) Advanced operations: JOIN, subquery and transaction processing. 4) Debugging skills: Check syntax, data type and permissions. 5) Optimization suggestions: Use indexes, avoid SELECT* and use transactions.

How to view database password in Navicat for MariaDB? How to view database password in Navicat for MariaDB? Apr 08, 2025 pm 09:18 PM

Navicat for MariaDB cannot view the database password directly because the password is stored in encrypted form. To ensure the database security, there are three ways to reset your password: reset your password through Navicat and set a complex password. View the configuration file (not recommended, high risk). Use system command line tools (not recommended, you need to be proficient in command line tools).

How to create a new connection to mysql in navicat How to create a new connection to mysql in navicat Apr 09, 2025 am 07:21 AM

You can create a new MySQL connection in Navicat by following the steps: Open the application and select New Connection (Ctrl N). Select "MySQL" as the connection type. Enter the hostname/IP address, port, username, and password. (Optional) Configure advanced options. Save the connection and enter the connection name.

MySQL and SQL: Essential Skills for Developers MySQL and SQL: Essential Skills for Developers Apr 10, 2025 am 09:30 AM

MySQL and SQL are essential skills for developers. 1.MySQL is an open source relational database management system, and SQL is the standard language used to manage and operate databases. 2.MySQL supports multiple storage engines through efficient data storage and retrieval functions, and SQL completes complex data operations through simple statements. 3. Examples of usage include basic queries and advanced queries, such as filtering and sorting by condition. 4. Common errors include syntax errors and performance issues, which can be optimized by checking SQL statements and using EXPLAIN commands. 5. Performance optimization techniques include using indexes, avoiding full table scanning, optimizing JOIN operations and improving code readability.

How to execute sql in navicat How to execute sql in navicat Apr 08, 2025 pm 11:42 PM

Steps to perform SQL in Navicat: Connect to the database. Create a SQL Editor window. Write SQL queries or scripts. Click the Run button to execute a query or script. View the results (if the query is executed).

See all articles