Friday, 24 June 2016

find out MySQL URL, host, port and username


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;
======================================================================

SHOW VARIABLES WHERE Variable_name = 'port';


mysql> SHOW VARIABLES WHERE Variable_name = 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port          | 3306  |
+---------------+-------+
1 row in set (0.00 sec)
It will give you the port number on which MySQL is running.

If you want to know the hostname of your Mysql you can use this query on MySQL Command line client --
SHOW VARIABLES WHERE Variable_name = 'hostname';


mysql> SHOW VARIABLES WHERE Variable_name = 'hostname';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| hostname          | Dell  |
+-------------------+-------+
1 row in set (0.00 sec)
It will give you the hostname for mysql.

If you want to know the username of your Mysql you can use this query on MySQL Command line client --
select user();   


mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
It will give you the username for mysql.



=======================================================================


Install mysql console from chrome store.



-> open mysql console

1)login localhost 3306 sree 1234


sree@localhost:3306>show databases;

======================================================================

No comments:

Post a Comment