External database ssh connection in symfony parameters.yml - mysql

Anybody setup a connection to an external mysql database, only available via SSH, in their symfony app? Can this be done in the parameters.yml?

You have to open an SSH tunnel. See Can I SSH to MySQL with the GUI tools? or Access Your MySQL Server Remotely Over SSH.
For parameters.yml this looks like a local MySql server, wich menans there's nothing special.

Related

How to connect MYSQL Data Base to my Django app via an ssh

How to connect my Django app to MySQL DB via ssh. I have a MySQL DB hosted in Namecheap. I can connect to it via ssh using a terminal, is there any way I can do that??
You might be able to set up an SSH tunnel.
https://www.ssh.com/academy/ssh/tunneling/example

Can't connect to mysql server (LAMP) in google cloud

I installed LAMP on a VM instance on Google cloud but when i try to access mysql database remotely from my linux terminal using
$ mysql -u username -h ipaddress -p
after entering password nothing happens (no error). I tried accessing it locally via ssh it works.
Is there any other setting on cloud platform. I need to change before accessing database from a remote pc. Followed this tutorial but it just stops after entering password.
Tried commenting out bind address but didn't work. Need help.
Just to be clear, are you using the mysql command on your remote machine or through SSH?
Normally, you should never allow external access to remote MySQL for security reasons, especially if the only app accessing the data is local. (however, it's unclear if that is the reason why you can't connect)
This is how you should connect:
Connect to your remote VM using SSH (ex: ssh user#ipaddress)
THEN, connect to your MySQL instance.
When connecting using a DB editor, some editors allow MySQL connections through SSH. Sequel Pro for Mac does this very well.

Connect to MySQL over SSH with agent using MySQL Workbench (or other)

I use for connecting any SSH Session the Plugin keeagent in my Keepass (it works like pageant). So I haven never enter my Password an by private Key is stored in my keepass file. It exists several tools, that works fine with using a SSH agent. But I don't find a way to use a SSH Tunnel using an agent in MySQL Workbench.
Is it possible to connect with MySQL Workbench over SSH Tunnel using an agent?
If not, does anyone knows, which tool supports this feature?
MySQL Workbench does not support using an SSH agent when SSH tunnelling, only password and passphrase-less key. On the latter: it supports SSH keys only when they do not have a passphrase. This is as of MySQL Workbench 8.0.19.
The TablePlus client does support using an agent; more specifically it uses the standard ssh_config to extract the various options to use when connecting via an SSH host.
First, MySQL Workbench itself can create an SSH tunnel. You can determine all the details when you choose a connection to be TCP/IP over SSH.
And MySQL Workbench can also use any existing tunnel in the system (be it from keeagent or putty). You just have to know the used local port for the tunnel and use that for the connection in MySQL Workbench. It appears in WB as if you have a local connection then.

Intellij IDEA ssh tunnel to datasource

I'm trying to view my remote database running on digital ocean droplet as data source in Intellij IDEA.
ssh tunnel settings
general database settings
I accessed the database from Sequel Pro through ssh so I believe it is set correctly on the server side.
When I test the connection it says: Connection refused by foreign host.
What have I done wrong?
The ip is correct and the passwords and ssh keys as well, I'm certain of that.
usually the ssh port is 22, if you haven't it customized.
If this tunnel is successful, you can connect against your database with the given port.
Check your screenshot. It shows 3306 for the ssh tunnel.

Workbench migration via ssh - how to set up a tunnel

I try to migrate MSSQL (local machine) to MYSQL (Amazon Web Services) usin Workbench. I can connect to both databases. However when I migrate I get this error:
Mysql connections through SSH are not supported in this version...
Well, I found this in documentation:
A workaround is to set up an encrypted tunnel, and then treat the MySQL target as a standard TCP (unencrypted) connection.
But I don't know how to set up a tunnel. Does anyone can help?
Okay, if I'm understanding this correctly, I think I'd prefer to set up a tunnel in Putty. I don't have a solid grasp of how MySQL Workbench works (I'm assuming its analogous to SSMS), but I have used maaany SSH tunnels in my day. Here are some basic instructions:
http://www.electrictoolbox.com/putty-create-ssh-port-tunnel/
You'll want to create a local tunnel from any port you choose (although I'd go with the MySQL default 3306) to the destination of 127.0.0.1:3306. Be sure to click add and save your session settings in Putty.
Open the SSH connection to the AWS machine. Try to connect to your MySQL instance through 127.0.0.1:3306. This should allow you to pull from your local SQL Server and send data to your AWS instance (through the tunnel, 127.0.0.1:3306 of course).
Hope this helps. Let me know if this doesn't solve your issue.
If you have Amazon ec2:
On Windows machine connect using putty via ssh:
In session host name (user#public_ip_address)
Connection -> SSH -> Tunnels (Source port: 3306 OR choose free one) AND (Destination 127.0.0.1:3306)
You can check if tunnel was establihed in event log (right click on terminal bar)
In Workbench now you can use TCP/IP without SSH.
Thanks guys!