您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

mysql怎么查看用户名?

2025/10/29 15:55:25发布16次查看
mysql查看用户名的方法:首先进入mysql并启动数据库;然后连接到数据库;最后输入“select host,user from mysql.user;”命令查看用户名以及信息即可。
我们在使用mysql的时候,有时候需要来查看当前用户。本篇文章将和大家讲述mysql怎么查看用户名,感兴趣的朋友可以了解一下。
启动数据库:
[root@server ~]# mysqld_safe &[1] 3289[root@server ~]# 130913 08:19:58 mysqld_safe logging to '/usr/local/mysql/data/server.gao.err'.130913 08:19:58 mysqld_safe starting mysqld daemon with databases from /usr/local/mysql/data
连接到数据库:
[root@server ~]# mysql -uroot -penter password: welcome to the mysql monitor. commands end with ; or \g.your mysql connection id is 1server version: 5.6.13 mysql community server (gpl)copyright (c) 2000, 2013, oracle and/or its affiliates. all rights reserved.oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners.type 'help;' or '\h' for help. type '\c' to clear the current input statement.mysql>
查看数据库列表:
mysql> show databases;+--------------------+| database |+--------------------+| information_schema || mysql || performance_schema || test |+--------------------+rows in set (0.00 sec)mysql>
查看用户状态:
mysql> use mysql;reading table information for completion of table and column namesyou can turn off this feature to get a quicker startup with -adatabase changedmysql> select host,user from mysql.user;+------------+------+| host | user |+------------+------+| 127.0.0.1 | root || ::1 | root || localhost | || localhost | root || server.gao | || server.gao | root |+------------+------+rows in set (0.00 sec)mysql>
以上就是mysql怎么查看用户名?的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product