Connect to database fails

After installing a fresh VM with Ubuntu Server 20.04.1 (system updates done) and installed the DEB package from dolibarr_12.0.2-4_all.deb from SourceForge using Muon Package Manager from Lubuntu GUI I get the following message when installing dolibarr from http://localhost/dolibarr:

Connect to database fails. Check database server is running (for example, with mysql/mariadb, you can launch it from command line with ‘sudo service mysql start’).

The database connection failed: the host or super user parameters must be wrong.

Go back and check/correct the parameters.

The prerequisites page beforehand showed everything was installed:

![Ok] PHP Version 7.4.3
![Ok] This PHP supports variables POST and GET.
![Ok] This PHP supports sessions.
![Ok] This PHP supports GD graphical functions.
![Ok] This PHP supports Curl.
![Ok] This PHP supports calendars extensions.
![Ok] This PHP supports UTF8 functions.
![Ok] This PHP supports Intl functions.
![Ok] This PHP supports ZIP functions.
![Ok] Your PHP max session memory is set to 128M . This should be enough.
![Ok] Configuration file /etc/dolibarr/conf.php could be created.
![Ok] Configuration file /etc/dolibarr/conf.php is writable.

What could be causing this?

Hi,

Before installing Dolibarr, you should have installed the LAMP stack : https://www.linuxbabe.com/ubuntu/install-lamp-stack-ubuntu-20-04-server-desktop

Thank you for the suggestion. That helped me install mariaDB which I knew I didn’t have installed. I ran through the link you gave me and followed each step verbatim. I was getting this with the prerequisites check:

![Ok] PHP Version 7.4.3
![Ok] This PHP supports variables POST and GET.
![Ok] This PHP supports sessions.
![Error] Your PHP installation does not support GD graphical functions. No graphs will be available.
![Error] Your PHP installation does not support Curl.
![Ok] This PHP supports calendars extensions.
![Ok] This PHP supports UTF8 functions.
![Error] Your PHP installation does not support Intl functions.
![Error] Your PHP installation does not support ZIP functions.
![Ok] Your PHP max session memory is set to 128M . This should be enough.
![Ok] Configuration file /etc/dolibarr/conf.php could be created.
![Ok] Configuration file /etc/dolibarr/conf.php is writable.

So I manually installed those modules using sudo apt-get install php7.4- and it checked everything off. I had to create a user under the mariaDB (I named it ‘admin’ and assigned administrative rights to it for all databases in the system) because it was still giving me the error Connect to database fails. and I discovered it was because although my check to sign into the database (mysql) worked when I tried it under ‘root’ I found that mariaDB didn’t accept the same credentials. I may be mistaken here, but creating that ‘admin’ user worked for me from that point forward.

For anybody running into this issue, follow these steps:

  1. Install LAMP (just a fancy way of saying "install Linux, Apache, Mysql, and PHP) by following the online guide provided by ksar in the comment above.

  2. Then create an ‘admin’ user with administrative rights in your mariaDB database by following this online guide starting on Step 3: https://www.digitalocean.com/community/tutorials/how-to-install-mariadb-on-ubuntu-20-04#step-3-—-(optional)-creating-an-administrative-user-that-employs-password-authentication

  3. Then, believe it or not, when you do finally get it all technically running, follow this online guide to actually setup your Dolibarr ERP/CRM system: https://wiki.dolibarr.org/index.php/First_setup

Thank you for that initial link, ksar!