I have mysql running on my localhost I can connect it by running:
mysql -h 127.0.0.1 -P 3306 -u root -p
I also ran docker container with co
Use the default route. For example:
~# ip route show | grep "default" | awk '{print $3}'
172.18.0.1
then
mysql -h 172.18.0.1 -P 3306 -u root -p
if you need to automate that, let's say, use that IP on a shell script, send it to a shell script, take it as:
host=$(ip route show | grep \"default\" | awk '{print $3}' | xargs echo -n)
then you have the host ip addr on $host