By miketccraig
I have tried using MySQL Workbench to try and connect to a droplet with a WordPress One-Click installation but cannot seem to communicate with that install. I’m using the public IP address for the droplet, port 3306, “root” as the user name and then went to the droplet console and found the .digitalocean_password file and copied the “root_mysql_pass” value to use as the password but when I test the connection, workbench just tells me “failed to connect to MySQL at ip:port with user root…unable to connect to localhost”. Is this not possible in a One-Click wordpress droplet installation ?
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!
Hi @miketccraig,
By default, the MySQL Port -3306 is closed for connections coming outside of the droplet. This is done for security reasons as often no one needs to have access to the MySQL server outside of the Droplet.
Now, when someone wants to access MySQL as in your case, they need to allow their IP on port 3306 and then try again. Don’t worry, it’s very easy.
On your Droplet, you need to run:
sudo iptables -A INPUT -p tcp -s XXX.XXX.XXX.XXX --dport 3306 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 3306 -m conntrack --ctstate ESTABLISHED -j ACCEPT
where XXX.XXX.XXX.XXX is your IP address.
Now, if you are using UFW (I’m mentioning this as I’m not sure which one did the WordPress One-Click Droplet is using), you can achieve this by running :
sudo ufw allow from XXX.XXX.XXX.XXX to any port 3306
again where XXX.XXX.XXX.XXX is your IP address.
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.