如何在MySQL中使用命令行获取用户帐户列表? [英] How to get a list of user accounts using the command line in MySQL?

查看:150
本文介绍了如何在MySQL中使用命令行获取用户帐户列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MySQL命令行实用程序,并且可以浏览数据库.现在,我需要查看用户帐户列表.我该怎么办?

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?

我正在使用MySQL版本5.4.1.

I'm using MySQL version 5.4.1.

推荐答案

使用此查询:

SELECT User FROM mysql.user;

哪个将输出如下表:

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

正如Matthew Scharley 指出对这个答案的评论,如果您只想查看唯一的用户名,则可以按User列进行分组.

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.

这篇关于如何在MySQL中使用命令行获取用户帐户列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆