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

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

    Easiest way is probably using command status; In the output you'll find database, user, host and port:

    mysql> status;
    --------------
    mysql  Ver 8.0.13 for Win64 on x86_64 (MySQL Community Server - GPL)
    
    Connection id:          43
    Current database:       mysql
    Current user:           user@localhost
    SSL:                    Cipher in use is DHE-RSA-AES128-GCM-SHA256
    Using delimiter:        ;
    Server version:         8.0.13 MySQL Community Server - GPL
    Protocol version:       10
    Connection:             localhost via TCP/IP
    Server characterset:    utf8mb4
    Db     characterset:    utf8mb4
    Client characterset:    cp852
    Conn.  characterset:    cp852
    TCP port:               3306
    Uptime:                 3 hours 32 min 40 sec
    
    Threads: 3  Questions: 197  Slow queries: 0  Opens: 214  Flush tables: 2  Open tables: 190  Queries per second avg: 0.015
    --------------
    

提交回复
热议问题