In summary, if you need to list the users in a MySQL database, I hope this has been helpful. So for most cases where you want to show MySQL user accounts you'll probably want to limit your MySQL users' query to a few important columns, something like this: select host, user, password from er | max_user_connections | int(11) unsigned | NO | | 0 | | | max_connections | int(11) unsigned | NO | | 0 | | | max_updates | int(11) unsigned | NO | | 0 | | | max_questions | int(11) unsigned | NO | | 0 | | | Alter_routine_priv | enum('N','Y') | NO | | N | | | Create_routine_priv | enum('N','Y') | NO | | N | | The statement requires the SELECT privilege for the mysql database, except for the current user. | Create_tmp_table_priv | enum('N','Y') | NO | | N | | Shows the CREATE USER statement that created the given user. | References_priv | enum('N','Y') | NO | | N | | As you can see, all existing local database. | File_priv | enum('N','Y') | NO | | N | | To get all the users in MySQL, run the below-stated command: SELECT user FROM er. | Field | Type | Null | Key | Default | Extra | On my current server this shows the following 37 columns of MySQL user information, as shown here: You can get a listing of the fields in the er table by running this MySQL query: How to reduce the amount of ‘user’ information shown ![]() The next section provides more details and information about this second query. Mysql> select host, user, password from er This makes for a lot of output, so as a practical matter you may want to trim down some of the fields to display, something like this: However, note that this query shows all of the columns from the er table. To show the users in a MySQL database, first log into your MySQL server as an administrative user using the mysql command line client, then run this MySQL query: MySQL FAQ: How do I show/list MySQL users, i.e., the user accounts in a MySQL or MariaDB database? Solution
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |