通过 SQL 命令显示 MySQL 主机?
mysqlmysqli database更新于 2025/4/3 16:12:17
要通过 SQL 命令显示 MySQL 主机,请使用系统变量"hostname"。
以下是显示主机的查询 −
mysql> select @@hostname;
这是输出 −
+-----------------+ | @@hostname | +-----------------+ | DESKTOP-QN2RB3H | +-----------------+ 1 row in set (0.00 sec)
或者您可以使用"show variable"命令通过 SQL 命令显示 MySQL 主机。
show variables where Variable_name like '%host%';
The following is the output −
+-------------------------------+-----------------+ | Variable_name | Value | +-------------------------------+-----------------+ | host_cache_size | 279 | | hostname | DESKTOP-QN2RB3H | | performance_schema_hosts_size | -1 | | report_host | | +-------------------------------+-----------------+ 4 rows in set (0.07 sec)
相关文章
有用资源
mysql 参考教程 - 该教程包含有关 mysql 的更多信息:https://www.cainiaomax.com/mysql/

