Unable to access WebUI: Error connecting to database

Hi guys,

I’m a newbie in here. I am experiencing problem in installing my LibreNMS with Ubuntu 16.0.4

Everything in my ./validate.php is in OK status and yet whenever I tried accessing the webUI using IP address, all I can see is ERROR CONNECTING TO DATABASE. And also, I just followed the instruction stated in the documentation.

root@LibreNMS:/opt/librenms# ./validate.php

Component Version
LibreNMS 1.42.01-30-g4c6f917
DB Schema 258
PHP 7.0.30-0ubuntu0.16.04.1
MySQL 10.0.34-MariaDB-0ubuntu0.16.04.1
RRDTool 1.5.5

[OK] Composer Version: 1.7.1
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] You have not added any devices yet.
[FIX] You can add a device in the webui or with ./addhost.php

Hoping that anyone from you could give me a hint on what could be the possible problem on my configuration.

Thank you!

Check your .env file in librenms dir.

Database configuration are in both files

Hi sir,

Thank you for responding. Can you help me in executing the command?
Where can I locate the .env file?

nano /opt/librenms/.env

Edit with correct sql credentials, save and try again.

I have checked the directory, but I cannot locate the .env file.


Believe me when I say it is there.

Try running ls -la

1 Like

Great!! I was able to run the command and it was successful. Thanks to you!

Now I am having another issue with regards to config.php which says I needed to copy the config.php.default. So I did it also, and seems like it was a success. But then after I access the UI it doesn’t lead me to the first 1 to 6 steps.

And now I’m stuck AGAIN with this UI. I tried logging the credentials I made during the configuration of MySQL but then it’s invalid.

Be sure that you have the correct mysql credentials in both, config.php and .env files.

Anyways, pastebin the output of ./validate.php

PS: Always run all commands as your librenms user.