Trying to describe a bit better what I understand from your question at first:
You have a host with mysql installed (not dockerized, but directly
on your host)
You have some client apps connecting to that MySQL in your host
using your localhost IP and the mysql port (let's say:
127.0.0.1:3306 by default)
Now you created a docker container with another app (inside the
container) that you want to have connected with your MySQL server,
which is still running in your host, accessible locally, but out
of your new container (or any other container)
You want your dockerized service to remain isolated, with no other contact with anything else outside your container (but the MySQL server, of course)

⚠️ Well, I'm going to start by ruling out the option of using --net=host (even when it could work in similar cases to allow your services to "live" in your host's network) since you don't want your container to be available from your other host's processes nor having access to anything else (which would happen with host networking)
Connecting to [non-dockerized] services in your host
✔️ In this case, what you actually need to do (from your app inside your container) is to connect to your Docker Host's IP
But not to the IP in your regular local network (e.g.: 192.168.1.5) nor in your public/wlan network, but to the IP that docker assigns to your host within your docker network itself (the network that docker creates to comunicate with and between your containers)
By default (if you don't specify any other network settings for your container) your container should be using the docker's bridge network, which is setup in the host (not inside the container) and commonly named docker0
So, it's as simple as finding the IP corresponding to your Host, and using that one as your mysql client's bind_address (e.g.: jdbc:mysql://172.X.XX.XX:3306 or $dbhost = "172.X.XX.XX"; etc.)
What is my Docker Host IP address?
Ok... and how can I find the IP that docker assigns to my host (the one for the docker's bridge network)?
Manually
You can just list all of your current assigned IP addresses, to find the one corresponding to that docker0 network:
ip -4 addr
or even better by directly filtering the one that you want:
ip -4 addr show docker0
You'll get an output similar to this:
3: docker0: mtu 1500 qdisc noqueue
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
And copy the ip that appears there after inet
Automatically
I like using this script to directly grab my current docker's host IP (especially useful when testing across many hosts):
ip -4 addr show docker0 | awk '$1=="inet" {print $2}' | cut -d/ -f1
Just put it in some handly place (e.g. in your /.bashrc) assigned to some environment variable:
export DOCKER_HOST_IP="$(ip -4 addr show docker0 | awk '$1=="inet" {print $2}' | cut -d/ -f1 )"
Hope it could be useful!