Show Database Use database show tables Describe <table>
All good and well, but is it possible to show the current connections host. Not connection_id, but the IP Address or Name of the host.
Another way to find out the port which MySQL Server is using on Windows is , Go to my. ini file that is MySQL configuration file and you can check the port. To find the my. ini file for MySQL Server, you can go to services and then go to properties.
To access a specific database, type the following command at the mysql> prompt, replacing dbname with the name of the database that you want to access: Copy use dbname; Make sure you do not forget the semicolon at the end of the statement. After you access a database, you can run SQL queries, list tables, and so on.
Show MySQL Databases The most common way to get a list of the MySQL databases is by using the mysql client to connect to the MySQL server and run the SHOW DATABASES command. If you haven't set a password for your MySQL user you can omit the -p switch.
To get current host name :-
select @@hostname; show variables where Variable_name like '%host%';
To get hosts for all incoming requests :-
select host from information_schema.processlist;
Based on your last comment,
I don't think you can resolve IP for the hostname using pure mysql function,
as it require a network lookup, which could be taking long time.
However, mysql document mention this :-
resolveip google.com.sg
docs :- http://dev.mysql.com/doc/refman/5.0/en/resolveip.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