如何从 phpmyadmin 中找出 mySQL 服务器的 IP 地址
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6483268/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to find out mySQL server ip address from phpmyadmin
提问by Crd007
I have access to my server's phpmyadmin. But how can I find that mysql's Ip address from phpmyadmin. My webserver and mysql is using different IPs.
我可以访问我服务器的 phpmyadmin。但是我怎样才能从phpmyadmin 中找到那个mysql 的IP 地址呢?我的网络服务器和 mysql 使用不同的 IP。
Is there any way to find this out?
有没有办法找出这个?
回答by Waruna Manjula
The SQL query SHOW VARIABLES WHERE Variable_name = 'hostname'will show you the hostname of the MySQL server which you can easily resolve to its IP address.
SQL 查询SHOW VARIABLES WHERE Variable_name = 'hostname'将向您显示 MySQL 服务器的主机名,您可以轻松地将其解析为其 IP 地址。
SHOW VARIABLES WHERE Variable_name = 'port'Will give you the port number.
SHOW VARIABLES WHERE Variable_name = 'port'会给你端口号。
You can find details about this in MySQL's manual: 12.4.5.41. SHOW VARIABLES Syntax and 5.1.4. Server System Variables
您可以在 MySQL 手册:12.4.5.41 中找到有关此内容的详细信息。显示变量语法和 5.1.4。服务器系统变量
回答by Louis
MySQL doesn't care what IP its on. Closest you could get would be hostname:
MySQL 不关心它的 IP。你能得到的最接近的是主机名:
select * from GLOBAL_variables where variable_name like 'hostname';
回答by ted
select * from SHOW VARIABLES WHERE Variable_name = 'hostname';
回答by fvu
The server's address is stored in config.php
服务器地址保存在config.php中
回答by Spechal
As an alternative, since you know the hostname, resolve the database server IP via hostname from the web server.
作为替代方案,因为您知道主机名,所以通过来自 Web 服务器的主机名解析数据库服务器 IP。
回答by Pavan Mehta
You can ssh to your server and run this command
您可以通过 ssh 连接到您的服务器并运行此命令
ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
It worked for me..
它对我有用..