Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
372 views
in Technique[技术] by (71.8m points)

mysql - 如何使用MySQL中的命令行获取用户帐户列表?(How to get a list of user accounts using the command line in MySQL?)

I'm using the MySQL command line utility and can navigate through a database.

(我正在使用MySQL命令行实用程序,可以在数据库中导航。)

Now I need to see a list of user accounts.

(现在我需要查看用户帐户列表。)

How can I do this?

(我怎样才能做到这一点?)

I'm using MySQL version 5.4.1 .

(我正在使用MySQL版本5.4.1 。)

  ask by burntsugar translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use this query:

(使用此查询:)

SELECT User FROM mysql.user;

Which will output a table like this:

(这将输出如下表格:)

+-------+
| User  |
+-------+
| root  |
+-------+
| user2 |
+-------+

As Matthew Scharley points out in the comments on this answer , you can group by the User column if you'd only like to see unique usernames.

(正如Matthew Scharley 在对此答案的评论中指出的那样,如果您只想查看唯一的用户名,则可以按“ User列进行分组。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[5] html - How to create even cell spacing within a

1.4m articles

1.4m replys

5 comments

57.0k users

...