How do I find out my MySQL URL, host, port and username?

前端 未结 10 2134
北恋
北恋 2021-01-29 17:35

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 ne

10条回答
  •  南方客
    南方客 (楼主)
    2021-01-29 18:15

    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)
    

    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;
    

提交回复
热议问题