如何找到我的MySQL URL,主机,端口和用户名? [英] How do I find out my MySQL URL, host, port and username?
本文介绍了如何找到我的MySQL URL,主机,端口和用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要找到我的MySQL用户名。当我打开MySQL命令行客户端,它只询问我的密码。我不记得我的用户名。对于与JDBC的连接,我需要URL,主机和端口号。
I need to find my MySQL username. When I open the MySQL command line client, it only asks me for my password. I don't remember my username. And for connectivity with JDBC, I need the URL, host and port number. Where do I find all of these?
推荐答案
如果您已经登录到命令行客户端,请尝试:
If you're already logged into the command line client try this:
mysql> select user();
它将输出类似于下面的内容:
It will output something similar to this:
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.41 sec)
在上面的示例中,我以 root 从
localhost
。
In my example above, I was logged in as root
from localhost
.
要查找端口号和其他有趣的设置,请使用以下命令:
To find port number and other interesting settings use this command:
mysql> show variables;
这篇关于如何找到我的MySQL URL,主机,端口和用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文