- Posts: 9
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Remote database connection does not work with '$' in database username
- SimonCropper
- Topic Author
- Offline
- New Member
Less
More
5 years 3 months ago #179081
by SimonCropper
Cheers Simon
Remote database connection does not work with '$' in database username was created by 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
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
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
5 years 3 months ago #179137
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Remote database connection does not work with '$' in database username
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.
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 answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 3 months ago #179141
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Remote database connection does not work with '$' in database username
LS don't really filter , see
secure.php.net/manual/en/language.variables.basics.php
$ is a special character,
$ 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 , plugin development .
I don't answer to private message.
The topic has been locked.
- SimonCropper
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
5 years 3 months ago #179169
by SimonCropper
Cheers Simon
Replied by SimonCropper on topic Remote database connection does not work with '$' in database username
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
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 3 months ago #179175
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Remote database connection does not work with '$' in database username
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- SimonCropper
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
5 years 3 months ago #179222
by SimonCropper
Cheers Simon
Replied by SimonCropper on topic Remote database connection does not work with '$' in database username
I checked, and the connection string is surrounded by single inverted commas that same as your example.
Cheers Simon
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 3 months ago #179231
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Remote database connection does not work with '$' in database username
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 , plugin development .
I don't answer to private message.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11637
- Thank you received: 2737
5 years 3 months ago #179272
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Remote database connection does not work with '$' in database username
Which makes it a LS issue, if Yii comes with LS.but i think it's a Yii issue, not a LS issue
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The topic has been locked.
- SimonCropper
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
5 years 3 months ago #179274
by SimonCropper
Cheers Simon
Replied by SimonCropper on topic Remote database connection does not work with '$' in database username
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
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 3 months ago #179279
by DenisChenu
And clearly, i'm sure if bug is reported , it was fixed by an update to manuel «don't use $ in sql username»
(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 , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Remote database connection does not work with '$' in database username
Yes, but more hard to fix …holch wrote:
Which makes it a LS issue, if Yii comes with LS.but i think it's a Yii issue, not a LS issue
And clearly, i'm sure if bug is reported , it was fixed by an update to manuel «don't use $ in sql username»
(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 , plugin development .
I don't answer to private message.
The topic has been locked.