The Passionate Craftsman

Ruby, PHP, MySql, Software engineering and more.

Friday, 16 November 2012

Show hostname in MySql with a query

First way:

mysql> show variables like 'hostname';
+---------------+------------------------+
| Variable_name | Value                  |
+---------------+------------------------+
| hostname      | domU-12-31-39-16-D6-7C |
+---------------+------------------------+
1 row in set (0.00 sec)

Second way:


mysql> SELECT @@hostname;
+-----------------------------+
| @@hostname                  |
+-----------------------------+
| Riccardos-MacBook-Pro.local |
+-----------------------------+
1 row in set (0.00 sec)

There are probably more ways to show the hostname, but two are more than enough for me.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home