为什么我的 MySQL 主机名是空的?以及如何解决?

why is my MySQL hostname empty ? and how to fix it?

所以我想知道我在 MySQL 中的主机名,但它给了我一个输出 Empty set (0.00 sec)

我都试过了:

mysql> SHOW VARIABLES WHERE Variable_name = 'hostname';
Empty set (0.00 sec)

和:

mysql> show variables like "%hostname%";
Empty set (0.00 sec)

您可以使用这些:

特别看一下SHOW变量的语法

select @@hostname;
show variables where Variable_name like '%host%';
show variables where Variable_name like '%hostname%';

你的版本中没有变量

hostname

The server sets this variable to the server host name at startup. This variable was added in MySQL5.0.38.