How to find out mySQL server ip address from phpmyadmin

前端 未结 6 1799
半阙折子戏
半阙折子戏 2020-12-24 13:31

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.

Is there any w

相关标签:
6条回答
  • 2020-12-24 13:50

    MySQL doesn't care what IP its on. Closest you could get would be hostname:

    select * from GLOBAL_variables where variable_name like 'hostname';
    
    0 讨论(0)
  • 2020-12-24 13:50

    You can ssh to your server and run this command

     ln -s /usr/share/phpmyadmin /var/www/phpmyadmin
    

    It worked for me..

    0 讨论(0)
  • 2020-12-24 13:53

    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.

    SHOW VARIABLES WHERE Variable_name = 'port' Will give you the port number.

    You can find details about this in MySQL's manual: 12.4.5.41. SHOW VARIABLES Syntax and 5.1.4. Server System Variables

    0 讨论(0)
  • 2020-12-24 13:58

    As an alternative, since you know the hostname, resolve the database server IP via hostname from the web server.

    http://php.net/manual/en/function.gethostbyname.php

    0 讨论(0)
  • 2020-12-24 14:03
    select * from SHOW VARIABLES WHERE Variable_name = 'hostname';
    
    0 讨论(0)
  • 2020-12-24 14:09

    The server's address is stored in config.php

    0 讨论(0)
提交回复
热议问题