If you are trying to connect to a MySQL server from a text-based MySQL client from another computer (be it Docker or not)
Most answers here involve connecting from a desktop client, or ask you to switch to an older authentication method. If you're connecting it with the MySQL client (text-based), I made it work with a Debian Buster in a Docker container.
Say you have the apt system and wget set up, do the following:
sudo apt-get update
sudo apt-get install lsb-release -y
sudo dpkg -i mysql-apt-config_0.8.13-1_all.deb
and select the options you want. In my case I only need MySQL Tools & Connectors
to be enabled.sudo apt-get update
sudo apt-get install mysql-client -y