Remote database connection does not work with '$' in database username

Plus d'informations
il y a 7 mois 1 semaine #179081 par SimonCropper
Hi Everyone,

This is as much a warning as a request for an explanation.

I have been trying the establish a remote MySQL / MariaDB connection for my LimeSurvey CE instance. LimeSurvey is on one machine (front-end) and the database on another (back-end).

We had an operational instance of limesurvey working when pointing to localhost - that is, when the database was on the same machine.

The minute we updated the config files to use a remote connection, no connection was made (all firewall setting were verified as being OK).

After quite a bit of effort we discovered that the problem was the user name. It included the charcater '$'.

So, if we had a MySQL user name 'abc$def' in the config file connection settings then the connection would not work. If we changed it to 'abcdef' it did (assuming the MySQL database has a user by that name). The inclusion of the '$' symbol was purely random and worked without any issues when the database was on the same machine.

The thing that got us thinking was when we tried to make a connection and 'abc'@somedomain.com was included in the error rather than 'abc$def'@somedomain.com. It appeared the connection was being made through the command line and the symbol $ was being treated as a macro substitution character - the variable 'def' was blank so the user name was truncated from 'abc$def' to 'abc'.

Anyway, can someone explain this? Does LimeSurvey use an external program to make remote connections via a command that is chained / piped thus explaining the abovementioned behaviour or am I misinterpreting what is happening?

Any feedback would be appreciated.

Cheers Simon

Cheers Simon

Connexion ou Créer un compte pour participer à la conversation.

LimeSurvey Partners
Plus d'informations
il y a 7 mois 1 semaine #179137 par holch
my guess would be that LS is filtering the "$" as this symbol is used in the configuration file, see here:

github.com/LimeSurvey/LimeSurvey/blob/ma.../config-defaults.php

So I guess if your variables like the MySQL user would include $ this might be a problem for LS to work. But this is just a guess, I am not a developer.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 1 semaine #179141 par DenisChenu
LS don't really filter , see secure.php.net/manual/en/language.variables.basics.php

$ is a special character,

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 .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 5 jours #179169 par SimonCropper
The puzzling thing is that when running on localhost LS worked fine. It was only when we moved the database to another machine that we had issues. This implies that a remote connection is made differently than a local connection but I can't find the point in the code that this occurs.

Cheers Simon

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 5 jours #179175 par DenisChenu
Can you check application/config/config.php if you use ' or " for string here : github.com/LimeSurvey/LimeSurvey/blob/f7...sample-mysql.php#L29

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 .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 4 jours #179222 par SimonCropper
I checked, and the connection string is surrounded by single inverted commas that same as your example.

Cheers Simon

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 4 jours #179231 par DenisChenu
Can you activate debug mode (to 2) maybe we can find where this replacement is done (but i think it's a Yii issue, not a LS issue).

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 .

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 3 jours #179272 par holch

but i think it's a Yii issue, not a LS issue

Which makes it a LS issue, if Yii comes with LS.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Les utilisateur(s) suivant ont remercié: LouisGac

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 3 jours #179274 par SimonCropper
Thanks for the feedack. Unfortunately LS did not even appear in the browser until this error was resolved so turning on debug will be mute. This suggests that essential data needed to present LS in the browser is stored in the database. No database connection, no LS. The only way we discovered the issue was manually connecting to the server, which in itself suggests that it is a MySQL, the MySQL linux drivers or the connection routine used by Yii that is causing the problem.

Cheers Simon

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 mois 3 jours #179279 par DenisChenu

holch écrit:

but i think it's a Yii issue, not a LS issue

Which makes it a LS issue, if Yii comes with LS.

Yes, but more hard to fix …

And clearly, i'm sure if bug is reported , it was fixed by an update to manuel «don't use $ in sql username» :P

(and it's understandable since $ is a reserved caracter in PHP)

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 .
Les utilisateur(s) suivant ont remercié: LouisGac

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!