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

前端 未结 10 2147
北恋
北恋 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:27

    For example, you can try:

    //If you want to get user, you need start query in your mysql:
    SELECT user(); // output your user: root@localhost
    SELECT system_user(); // --
    
    //If you want to get port your "mysql://user:pass@hostname:port/db"
    SELECT @@port; //3306 is default
    
    //If you want hostname your db, you can execute query
    SELECT @@hostname;
    

提交回复
热议问题