I am running my MySQL database on my machine, how do I get the ip of that MySQL server? I have already tried getting the ip of the machine but that doesn't work. I am running on Windows 8 OS on my machine and what I'm trying to do is connect a web page to my MySQL database which is on the MySQL server. They are not on the same network.
Use status in mysql prompt
mysql> status
OR
mysql> \s
Other ways,
SELECT SUBSTRING_INDEX(USER(), '@', -1) AS ip, @@hostname as hostname, @@port as port, DATABASE() as current_database;
SELECT * FROM information_schema.GLOBAL_VARIABLES where VARIABLE_NAME like 'hostname';
SELECT host FROM information_schema.processlist WHERE ID=connection_id();
Will give you the host name (or IP address if name resolution is not enabled, which it is usually not) connecting to the mysql server on the current connection.
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: https://dev.mysql.com/doc/refman/8.0/en/show-variables.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With