By Emre Caglar
Hi,
I have MySql installed on my server and I am using Apache as a proxy server to my Tomcat. I have SSL certificate installed. My current configuration is,
Apache :443 port requests ---- direct to-----> tomcat :8080 Apache :80 port requests -----direct to -----> web site
MySql installed and listening to default port 127.0.0.1:3306
So I have apache in front of everything and accepting :443 secure and :80 connections only.
I am trying to connect to my MySQL server remotely so any idea how can I do with SSL or without (i don’t prefer)
I have tried such solution below but it seems not working.
ANY SOLUTION?
thanks
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 ,
Thanks for the response.
I have tried it and getting error (either connection is being refused or getting timeout.)
1- As far as i understand, I need to add tunelling when i connect to my droplet through SSL (I am using putty so i added tunelling to my connection via putty)
So that i believe that ssh -L3306:localhost:3306 yourdroplet. command will be executed on my droplet. So ‘localhost’ there is my droplet actually. **Is that correct ? **
I am using below options for tunelling on Putty Source port: 3306 Destination: [my_droplet_ip]:3306 Local
2- I have also changed bind-address in my mysql config to 0.0.0.0 in order to accept remote connections. (it was 127.0.0.1 before for security) Is that step also correct?
3- I am not also sure if i should choose “Standart TCP/IP over SSH” or " Standart TCP/IP " on MySQL Workbench ? I am trying to connect with below parameters after making tunellign
SSH Hostname: [my_droplet_ip]:22 SSH Username : [my_droplet_login username] MySQL Hostname: 127.0.0.1 MySQL Server port: 3306 Username: [MySQL login user name]
4- Lastly my firewall output is shown below,
root@yarimelma:~# ufw status Status: active
To Action From
8080 ALLOW Anywhere Apache Full ALLOW Anywhere 22 ALLOW Anywhere 8080 (v6) ALLOW Anywhere (v6) Apache Full (v6) ALLOW Anywhere (v6) 22 (v6) ALLOW Anywhere (v6)
should i also allow 3306 port?
I am not sure where i am doing wrong ? Any idea?
Many thanks
Apache doesn’t speak the mysql protocol, so your vhost is trying to relay http to a mysql port.
If you’re just doing some one-off stuff and you can live with a web interface you could install phpmyadmin and you can run queries through it.
If you have an query tool type application like mysql workbench on your local machine and you want to talk to mysql on your droplets it’s best to use an ssh tunnel via ssh -L3306:localhost:3306 yourdroplet. As long as your ssh tunnel is alive port 3306 on your local machine will be connected to port 3306 on the mysql server on your droplet. Then you just tell the application to connect to localhost with the same user details. This trick isn’t the best if you want to use it for unattended jobs and one-off changes - it’s not stable enough for automated use.
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.