How to get a list of user accounts using the command line in MySQL?

前端 未结 15 1946
自闭症患者
自闭症患者 2020-12-22 14:35

I\'m using the MySQL command line utility and can navigate through a database. Now I need to see a list of user accounts. How can I do this?

I\'m using MySQL version

15条回答
  •  滥情空心
    2020-12-22 15:00

    MySQL stores the user information in its own database. The name of the database is MySQL. Inside that database, the user information is in a table, a dataset, named user. If you want to see what users are set up in the MySQL user table, run the following command:

    SELECT User, Host FROM mysql.user;
    
    +------------------+-----------+
    | User             | Host      |
    +------------------+-----------+
    | root             | localhost |
    | root             | demohost  |
    | root             | 127.0.0.1 |
    | debian-sys-maint | localhost |
    |                  | %         |
    +------------------+-----------+
    

提交回复
热议问题