Leantime / leantime

Leantime is a goals focused project management system for non-project managers. Building with ADHD, Autism, and dyslexia in mind.
https://leantime.io
GNU Affero General Public License v3.0
4.73k stars 597 forks source link

[Bug]: "Cannot connect to database" after Update to Leantime 3.3.0 #2789

Closed mott2060 closed 3 days ago

mott2060 commented 4 days ago

What is your set up?

Self Hosted Server

Version

3.3.0

Describe the issue

Hi all, I´ve just updated from 3.2.1 to 3.3.0 by manually replacing all files via FTP. Right after it I´ve reloaded the page and got the errpr message "Cannot connect to database".

The log file says:

[2024-11-18 15:00:01] production.ERROR: Can't connect to database
[2024-11-18 15:00:01] production.ERROR: PDOException: SQLSTATE[HY000] [2002] Connection refused in /html/leantime/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:65 Stack trace:

0 /html/leantime/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(65): PDO->__construct('...', '...', Object(SensitiveParameterValue), Array)

1 /html/leantime/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(83): Illuminate\Database\Connectors\Connector->createPdoConnection('...', '...', '', Array)

2 /html/leantime/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(48): Illuminate\Database\Connectors\Connector->tryAgainIfCausedByLostConnection(Object(PDOException), '...', '...', '', Array)

3 /html/leantime/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('...', Array, Array)

4 /html/leantime/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(184): Illuminate\Database\Connectors\MySqlConnector->connect(Array)

5 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors{closure}()

6 /html/leantime/vendor/laravel/framework/src/Illuminate/Database/Connection.php(1339): call_user_func(Object(Closure))

7 /html/leantime/app/Core/Db/Db.php(68): Illuminate\Database\Connection->getPdo()

8 [internal function]: Leantime\Core\Db\Db->__construct('...')

I had MySQL 5.7 but already updated to 8.0. I´ve also tested PHP 8.2 as well as 8.3 but still can´t leantime get running again. I´ve double checke the SQL server ID, username, passwort and port but with no success.

Does anyone has an idea what could be wrong?

Reproduction steps

  1. Replace all files via FTP.
  2. Navigate to your board´s URL.
  3. Refresh, ...

Additional Notes

No response

mott2060 commented 4 days ago

Switching back to the files of version 3.2.1 worked fine.

marcelfolaron commented 3 days ago

Is your config in a .env file? configuration.php or regular server environment vars?

mott2060 commented 3 days ago

Hi Marcel,It’s in a configuration.php. I first simply used the one from 3.2.1 but later also transferred all my settings into the sample file from 3.3.0.

hnegadi commented 3 days ago

Same issue here. We renamed old php configuration files -rw-r--r-- 1 www-data www-data 9050 Nov 18 22:04 configuration.env -rwxrwxr-x 1 www-data www-data 6422 Nov 18 21:39 configuration.php.old -rw-r--r-- 1 www-data www-data 6349 Nov 16 16:20 configuration.sample.php -rw-r--r-- 1 www-data www-data 9050 Nov 16 16:20 sample.env.old

and created configuration.env file with the same values as old configuration.php file. Still unable to connect to database.

marcelfolaron commented 3 days ago

configuration.env will not work. It needs to be called .env (no configuration in the front). The .env filename and format is being used to set php environment variables. It is also not enough to just rename the file, they have to follow the same format as the example in sample.env

I do have a temporary fix ready for configuration.php files but those will be deprecated in the future.

hnegadi commented 3 days ago

renaming configuration.env to -rw-r--r-- 1 www-data www-data 9050 Nov 18 22:04 .env worked ! Thank you. ( we've already been following sample.env guidelines )

marcelfolaron commented 3 days ago

Great @hnegadi @mott2060 I just released a patch with 3.3.1. Can you update and check again?

hnegadi commented 3 days ago

@marcelfolaron , 3.3.1 works with either configurataion.php or .env files

mott2060 commented 2 days ago

Thanks @marcelfolaron , patch worked perfectly!