How do I find out what my IP Address of my MySQL host is?

266,549

Solution 1

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

Solution 2

You may try this if using MySQL 5.7 version

 mysql> SELECT SUBSTRING_INDEX(USER(), '@', -1) AS ip,  @@hostname as hostname, @@port as port, DATABASE() as current_database;
+-----------+-----------------+------+------------------+
| ip        | hostname        | port | current_database |
+-----------+-----------------+------+------------------+
| localhost | host001         | 3306 | kakadba          |
+-----------+-----------------+------+------------------+
1 row in set (0.00 sec)

Or just write status in mysql prompt

mysql> \s

OR

 mysql> status

Solution 3

Using PHPMyAdmin all variables are already listed if you click "home" > "MySQL system variables". You can use the find feature of your browser to search for the "hostname" and the "port" variables or scroll to them. It's listed in alphabetical order. No mucking about with queries if you are a non technical person.

Solution 4

Once you are in phpMyAdmin, look for the horizontal menu:

Dashboard | Sql | Status | Users ...etc

Click on Variables.

Here you will find all the variables for mySql server. You can try the search box for specific variables.

Good Luck.

Share:
266,549

Related videos on Youtube

Deniz Zoeteman
Author by

Deniz Zoeteman

Updated on September 17, 2022

Comments

  • Deniz Zoeteman
    Deniz Zoeteman over 1 year

    I have a free domain running at x10hosting (x10.bz), and I want to find out the IP Address of my MySQL host for it, so I can contact the MySQL database from another host. I've already added that host to the access list, but now I need to find out the IP Address of the MySQL host. How can I find this out? x10 is using cPanel X and PHPMyAdmin.

  • Pacerier
    Pacerier almost 9 years
    My hostname says ubuntu. How do I check the IP address of that?
  • ThorSummoner
    ThorSummoner almost 6 years
    information_schema equivalent: select * from information_schema.GLOBAL_VARIABLES where VARIABLE_NAME like 'hostname';
  • Shardj
    Shardj almost 5 years
    I don't understand how hostname can supposedly be resolved to an IP address. Mine is running on docker so the hostname is jibberish.
  • Jie
    Jie almost 3 years
    Add ; at the end of the query like so: SHOW VARIABLES WHERE Variable_name = 'hostname';