By tonyaom
Hi,
I followed the tutorials here: https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-mysql-load-balancing--3
and successfully create HAproxy for a Master-Master Mysql
However, I am not able to find any correct way to connect a php app to the database through HAProxy
I tried netstat -tlpn | grep 3306 and got the following result:
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 946/haproxy
however, when trying mysql -h <IP of HAProxy Droplet> -u root -p
I could not connect because of incorrect password. My passwords are exactly as the ones in the tutorials and I have tried all of them but it doesn’t work.
Any help is really appreciated. Thank you in advanced
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
If you followed that tutorial, there are a few things to note:
haproxy_root not root as used in this question. So the password for the root user is the one from when you initially installed MySQL, not the user set up in the article.If you need to connect to the database from another host, you’ll need to change the bind address in your HAProxy configuration. To bind to all network interfaces, it should look like:
listen mysql-cluster
bind :3306
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.