Configuration LimeSurvey for having access to a DB through TCP/IP over SSH

10 months 3 days ago #173773 by cavo789
Hello all

After two hours of unsuccessfull search, I'm coming to you ... I can't find by myself.

I need to install LimeSurvey on my localhost server (done, easy) and configure it to use a database stored on a server only accessible over SSH.

I'm really not familiar with this so I've tested...

1. I can start a connection through Putty, connect to mysql on the command line, give credentials and I can get the list of tables (==> the credentials are correct and no firewall problem).

2. I've installed MySQL Workbench of Oracle and create a connection (image here below). It works. SSH hostname, port, username, MySQL host, ... it's OK, I can connect on the server and get the list of tables and see tables's content.

Now, LimeSurvey and the config.php file. I can't find how...

In components->db->connectionstring, the default is "mysql:host=localhost;port=3306;dbname=limesurvey;"

I've tried a lot like

* mysql:host=ssh_user:ssh_pwd@ssh_IP:22;port=3306;dbname=limesurvey; --> don't work

* mysql:host=ssh_IP:22;port=3306;dbname=limesurvey; --> don't work

* mysql:host=ssh_IP;port=22;dbname=limesurvey; --> don't work
* ...

Of course, components->db->username and components->db->password have been correctly initialized to the credentials needed to connect on mySQL.

Do you know how to do please ?

Thanks a lot


My Open Source software:

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
10 months 3 days ago #173777 by jelo
The MySQL Workbench is opening a SSH tunnel and then connects to the MySQL database.
You cannot do that in PHP (LimeSurvey) by just changing the connection string of the database layer.

To mimic the behavior of the MySQL Workbench a simple approach would mean to open a ssh connection (different approaches to open a ssh tunnel, e.g. via php shell_exec or on OS level).
The whole topic is not LimeSurvey related. It's a database or server topic, which involves some decisions about security and performance.

You will find a lot of information when searching for keywords "Connect remote MySQL SSH tunnel"
Some pro/cons can be found here

The meaning of the word "stable" for users

Please Log in or Create an account to join the conversation.

10 months 3 days ago #173780 by cavo789
That's a very complete answer @jelo; thank you !

It was also my intuition that this was not possible, but I could not have described it with words as simple as the ones you used. So, now, I know that, probably, the easiest way to do what I wish (having an access to the data) would be a mysql-dump and restore it, sometimes, locally.

Thanks Jelo ! Much appreciated

My Open Source software:

Please Log in or Create an account to join the conversation.

10 months 2 days ago #173801 by DenisChenu
Maybe using ssh_fs and unix_socket for connexion can be a good idea

But jelo are totally right : totally unrelated to LimeSurvey

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!