MySQL Port Listening with Consideration to Virtual Hosts
I’m running a Droplet with Ubuntu 14.04.1 LTS and I have multiple domains hosted there. I just setup phpmyadmin on the server and then realized, “Wait a sec… I need one of these for each domain! Bummer.”
Currently, when to make connections via php I use hostname 127.0.0.1 to connect to mysql. Here is why:
sudo netstat -plutn | grep -i sql Output: “`tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 960/mysqld
Is it recommended to only have mysql listening on the loopback interface? How can I make mysql listen on each of my virtual hosts (i.e. host='example.com') (i.e. host='example.net')? Can anyone think of a way that I can restrict access to databases for example.net requested from example.com (and vice versa)? Being a novice, it seems that these two questions are probably very closely related (control of mysql access via port listening). Thank you :) ~John
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.