Is there any way to know from which host I have connected?
host1> mysql -h10.10.10.10 -uroot -pPassWd
I connect to host2 from host1
How do I know from which host I am connected?
Update:
I do not want to know TO which host I am connected, but FROM which host I am connected.
The answers that work via current_user() won’t always work. If the user can connect via a wildcard, it’ll return something like
root@%orsomeuser@10.1.5.%user()returns the user as it’s connected, whilecurrent_user()returns the user as it was defined. So you can get your hostname like this:The host that you are connecting to can be retrieved like this: