Crd007
Crd007

Reputation: 493

How to find out mySQL server ip address from phpmyadmin

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?

Upvotes: 40

Views: 145494

Answers (7)

Enzo
Enzo

Reputation: 41

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

Upvotes: 0

ted
ted

Reputation: 97

select * from SHOW VARIABLES WHERE Variable_name = 'hostname';

Upvotes: 6

Waruna Manjula
Waruna Manjula

Reputation: 3487

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

Upvotes: 49

Spechal
Spechal

Reputation: 2706

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

Upvotes: 1

Pavan Mehta
Pavan Mehta

Reputation: 17

You can ssh to your server and run this command

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

It worked for me..

Upvotes: -2

Louis
Louis

Reputation: 292

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

select * from GLOBAL_variables where variable_name like 'hostname';

Upvotes: 11

fvu
fvu

Reputation: 32953

The server's address is stored in config.php

Upvotes: 3

Related Questions