table containing a description related to the user table, run the following MySQL command to query the database.<\/span><\/span><\/span><\/p>\r\n\r\n\r\n\r\nmysql> desc mysql.user;<\/pre>\r\n\r\n\r\n\r\nThe output will look similar to the one below. There are a lot of options!:<\/p>\r\n\r\n\r\n\r\n
mysql> desc mysql.user;\r\n+------------------------+-----------------------------------+------+-----+-----------------------+-------+\r\n| Field | Type | Null | Key | Default | Extra |\r\n+------------------------+-----------------------------------+------+-----+-----------------------+-------+\r\n| Host | char(60) | NO | PRI | | |\r\n| User | char(16) | NO | PRI | | |\r\n| Password | char(41) | NO | | | |\r\n| Select_priv | enum('N','Y') | NO | | N | |\r\n| Insert_priv | enum('N','Y') | NO | | N | |\r\n| Update_priv | enum('N','Y') | NO | | N | |\r\n| Delete_priv | enum('N','Y') | NO | | N | |\r\n| Create_priv | enum('N','Y') | NO | | N | |\r\n| Drop_priv | enum('N','Y') | NO | | N | |\r\n| Reload_priv | enum('N','Y') | NO | | N | |\r\n| Shutdown_priv | enum('N','Y') | NO | | N | |\r\n| Process_priv | enum('N','Y') | NO | | N | |\r\n| File_priv | enum('N','Y') | NO | | N | |\r\n| Grant_priv | enum('N','Y') | NO | | N | |\r\n| References_priv | enum('N','Y') | NO | | N | |\r\n| Index_priv | enum('N','Y') | NO | | N | |\r\n| Alter_priv | enum('N','Y') | NO | | N | |\r\n| Show_db_priv | enum('N','Y') | NO | | N | |\r\n| Super_priv | enum('N','Y') | NO | | N | |\r\n| Create_tmp_table_priv | enum('N','Y') | NO | | N | |\r\n| Lock_tables_priv | enum('N','Y') | NO | | N | |\r\n| Execute_priv | enum('N','Y') | NO | | N | |\r\n| Repl_slave_priv | enum('N','Y') | NO | | N | |\r\n| Repl_client_priv | enum('N','Y') | NO | | N | |\r\n| Create_view_priv | enum('N','Y') | NO | | N | |\r\n| Show_view_priv | enum('N','Y') | NO | | N | |\r\n| Create_routine_priv | enum('N','Y') | NO | | N | |\r\n| Alter_routine_priv | enum('N','Y') | NO | | N | |\r\n| Create_user_priv | enum('N','Y') | NO | | N | |\r\n| Event_priv | enum('N','Y') | NO | | N | |\r\n| Trigger_priv | enum('N','Y') | NO | | N | |\r\n| Create_tablespace_priv | enum('N','Y') | NO | | N | |\r\n| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |\r\n| ssl_cipher | blob | NO | | NULL | |\r\n| x509_issuer | blob | NO | | NULL | |\r\n| x509_subject | blob | NO | | NULL | |\r\n| max_questions | int(11) unsigned | NO | | 0 | |\r\n| max_updates | int(11) unsigned | NO | | 0 | |\r\n| max_connections | int(11) unsigned | NO | | 0 | |\r\n| max_user_connections | int(11) unsigned | NO | | 0 | |\r\n| plugin | char(64) | YES | | mysql_native_password | |\r\n| authentication_string | text | YES | | NULL | |\r\n| password_expired | enum('N','Y') | NO | | N | |\r\n+------------------------+-----------------------------------+------+-----+-----------------------+-------+\r\n43 rows in set (0.00 sec)\r\n<\/pre>\r\n\r\n\r\n\r\nyou can now combine this with the example given in Step 2. For example, if you want to return the list of users and their update privileges, you can run this command:<\/p>\r\n\r\n\r\n\r\n
SELECT User, Update_priv FROM mysql.user;<\/pre>\r\n\r\n\r\n\r\nJust replace “Update_priv” with any fields that you might need.<\/p>\r\n\r\n\r\n\r\n