CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]

More
10 months 2 weeks ago #146630 by klaus2333
klaus2333 created the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
Hi
I run LimeSurvey on Linux for a few years now. After a reboot, probably an update, lime does not start anymore.
I get the error
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] No such file or directory

Following my research I looked for the connectionstring in the config.php and found
'connectionString' => 'mysql:unix_socket=/usr/local/LimeSurvey/var/LimeSurvey_mysqld.sock;dbname=limesurvey;',

So I looked for the /usr/local/LimeSurvey/var/LimeSurvey_mysqld.sock file but it was not there.
Further research results:
change the connectionString to: 'connectionString' => 'mysql:host=127.0.0.1;unix_socket=/usr/local/LimeSurvey/var/LimeSurvey_mysqld.sock;dbname=limesurvey;',

so the new error:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Connection refused
I found I would have to change the my.cnf and delete skip-networking, but that did not change anything.

So my first question is how to recreate the /usr/local/LimeSurvey/var/LimeSurvey_mysqld.sock file as I hope the problem is solved with that.

can anyone help? its urgent ;(

thank you!
best
Klaus

Please Log in to join the conversation.

More
10 months 2 weeks ago #146653 by DenisChenu
DenisChenu replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]

klaus2333 wrote: Hi
change the connectionString to: 'connectionString' => 'mysql:host=127.0.0.1;unix_socket=/usr/local/LimeSurvey/var/LimeSurvey_mysqld.sock;dbname=limesurvey;',


Try
'connectionString' => 'mysql:host=localhost;port=3306;dbname=limesurvey;',

Are you sure DB still active mysql are on the same server ?
Did you try to connect with bash ?

can anyone help? its urgent ;(

support.sondages.pro/ :)

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

Please Log in to join the conversation.

More
10 months 2 weeks ago #146667 by klaus2333
klaus2333 replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
Hi Denis
Thank you for your reply. Yes I am sure Lime and DB are on the same server as it is a qnap application. So the installation is not customizable. In the night we gave it a few more tries and now the new situation is:
we backed up the limesurvey SQL directory with all the .frm, myd and myi files. We also backed up the my.cnf and the config.php. Than we did a fresh lime install (as the install is default we can assume the settings are the same as in the old installation).
The fresh installation works.
We replaced the SQL directory with the backed up limesurvey .frm, .myd and .myi files and we can see our old admin login works.
The problem now is, the old surveys as the current online survey and all the other data are not visible. The LimeSurvey Database integrity check says: The following old survey tables should be deleted because they contain no records or their parent survey no longer exists: <list of our surveys>
So the new question is how do we get the surveys back into lime?
Thank you!

Please Log in to join the conversation.

More
10 months 2 weeks ago #146668 by DenisChenu
DenisChenu replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
Surely must do a mysql check and restart ...

But you take big risk here ......

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

Please Log in to join the conversation.

More
9 months 1 day ago #148836 by Kevin
Kevin replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
I updated to 2.62.2+170203 a few days ago and I am also having the same issue. I got the error a few times after the update but refreshing the page seemed to work. Now I can't login or view a survey.

I can connect from the command prompt.

Please Log in to join the conversation.

More
9 months 1 day ago #148838 by Kevin
Kevin replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
I was able to fix it. The error showed that /tmp/mysql.sock was missing so I created a symbolic link with this command.
ln -s /usr/local/lib/mysql.sock /tmp/mysql.sock

Please Log in to join the conversation.

More
8 months 1 week ago #149958 by shru123
shru123 replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
I am facing same issues, I have installed new version of Apache 2.4.25 , php version 7.1.1. but in php 7.1.1 not supporting MySQL driver, it supports only mysqli. and limesurvey doesn't work without MySQL driver. please help me its urgent what to do.

Please Log in to join the conversation.

More
8 months 1 week ago #149960 by jelo
jelo replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]

shru123 wrote: I am facing same issues, I have installed new version of Apache 2.4.25 , php version 7.1.1. but in php 7.1.1 not supporting MySQL driver, it supports only mysqli. and limesurvey doesn't work without MySQL driver. please help me its urgent what to do.

What version/build of LimeSurvey is used?
To me this looks like you updated the server and now facing the issue that PHP 7.X deprecated the old mysql driver. LimeSurvey works fine with PHP 7. But you need to use a concurrent version.
If you have updated PHP before updating LimeSurvey you might roll PHP back to PHP 5.6.X to keep it running.


The error message itself can be indicate a lot of other issues as well. What version of MySQL is running?
Did you update that as well? And on what operating system in the whole stuff running?

Please Log in to join the conversation.

More
8 months 1 week ago #149961 by shru123
shru123 replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
LimeSurveyVersion 2.05+ Build 140730
mysql -MySQL server version 5.1
OS -windows server 2008

person who have issued for limesuvey have left the organization, so I don't know how to get new version of limesurvey.
do we need to pay again for new verion of limesurvey

Please Log in to join the conversation.

More
8 months 1 week ago #149962 by jelo
jelo replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
As a shorterm fix just switch to PHP 5.6 instead of PHP 7.X.
That should let you access LimeSurvey again.
You might consider buying a support package which will allow you to use the comfortupdater to easily access LTS versions of your installed LimeSurvey branch.
www.limesurvey.org/editions-and-prices/l...and-prices-community

Don't update your LimeSurvey installation with the newest branch. Just look out for 2.6.Z LTS and don't choose 2.6Y.Z (which is the newest branch and will break templates on your current LS installation).

Please Log in to join the conversation.

More
8 months 1 week ago #149966 by shru123
shru123 replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
I am not able to understand. I need to use php version as 7.1.1. But limesurvey is not working.
Connectionstring is giving problem

'connectionString' => 'mysql:host=localhost;port=3306;dbname=limesurvey;',

I need to change the above code just. can you help me. how do I do this.

Please Log in to join the conversation.

More
8 months 1 week ago #149969 by jelo
jelo replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]

shru123 wrote: I need to use php version as 7.1.1. But limesurvey is not working.

The limesurvey version you use (2014) is older than the release of PHP 7.X.
So why do you expect changing a connection string will do the trick? You will run into further issues.

If you want to learn about the different mysql interfaces which come with PHP 7 and still want to just change connection strings, you can take a look at this here:
php.net/manual/de/mysql.php

Good luck. I would be surprised if you get this old version of LimeSurvey running flawless under PHP 7.

Please Log in to join the conversation.

More
8 months 1 week ago #150012 by jelo
jelo replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]

shru123 wrote: LimeSurveyVersion 2.05+ Build 140730
mysql -MySQL server version 5.1
OS -windows server 2008


With newer LimeSurvey versions you need to update MySQL as well.
The absolute minimal requirements are:
Apache >= 2.4 | nginx >= 1.1 | any other php-ready webserver
php >= 5.4      with mbstring and pdo-database drivers
mysql >= 5.5.3 | pgsql >= 9 | mariadb >= 5.5 | mssql >= 2005

Please Log in to join the conversation.

More
8 months 6 days ago #150061 by shru123
shru123 replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
Do limesurvey works with SQLlite?...

Please Log in to join the conversation.

More
8 months 6 days ago #150064 by shru123
shru123 replied the topic: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002]
Do limesurvey works with SQLLite???..

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!