How to find out mySQL server ip address from phpmyadmin
Asked Answered
C

7

40

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 way to find this out?

Circularize answered 26/6, 2011 at 9:54 Comment(2)
https://mcmap.net/q/408428/-find-server-ip-by-sqlDemanding
@FrankerZ This question was asked 8 years ago around 7 years ago when you wrote you reply... he was seen for last time in 2012 you didnt really expect him to come back and accept an anwser?Wallacewallach
W
49

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

Waine answered 13/6, 2016 at 4:46 Comment(0)
E
11

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

select * from GLOBAL_variables where variable_name like 'hostname';
Ergo answered 30/7, 2013 at 4:30 Comment(0)
S
6
select * from SHOW VARIABLES WHERE Variable_name = 'hostname';
Scatology answered 23/3, 2015 at 20:25 Comment(1)
If someone is trying to run this in phpMyAdmin, remove the 'select * from'. It should simply be: SHOW VARIABLES WHERE Variable_name = 'hostname'Firefly
R
3

The server's address is stored in config.php

Rajah answered 26/6, 2011 at 9:57 Comment(0)
S
1

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

Sapient answered 23/3, 2015 at 20:43 Comment(0)
W
0

You can utilize the phpmyadmin interface and navigate to variables, then search for hostname and convert it to IP Address in the screenshots below:

enter image description here

enter image description here

enter image description here

Wizard answered 1/6 at 15:7 Comment(0)
B
-2

You can ssh to your server and run this command

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

It worked for me..

Burns answered 15/2, 2014 at 14:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.