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

前端 未结 10 2130
北恋
北恋 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:32
    mysql> SHOW VARIABLES WHERE Variable_name = 'hostname';
    +---------------+-----------+
    | Variable_name | Value     |
    +---------------+-----------+
    | hostname      | karola-pc |
    +---------------+-----------+
    1 row in set (0.00 sec)
    

    For Example in my case : karola-pc is the host name of the box where my mysql is running. And it my local PC host name.

    If it is romote box than you can ping that host directly if, If you are in network with that box you should be able to ping that host.

    If it UNIX or Linux you can run "hostname" command in terminal to check the host name. if it is windows you can see same value in MyComputer-> right click -> properties ->Computer Name you can see ( i.e System Properties)

    Hope it will answer your Q.

    0 讨论(0)
  • 2021-01-29 18:33

    If you use phpMyAdmin, click on Home, then Variables on the top menu. Look for the port setting on the page. The value it is set to is the port your MySQL server is running on.

    0 讨论(0)
  • 2021-01-29 18:34

    Here are the default settings

    default-username is root
    default-password is null/empty //mean nothing
    default-url is localhost or 127.0.0.1 for apache and
    localhost:/phpmyadmin for mysql // if you are using xampp/wamp/mamp
    default-port = 3306

    0 讨论(0)
  • 2021-01-29 18:36

    If using MySQL Workbench, simply look in the Session tab in the Information pane located in the sidebar.

    0 讨论(0)
提交回复
热议问题