Skip to main content

Hi all,

I’m trying to install Centreon 22.04 with a remote MariaDB server.

All prerequisites are OK on web & DB servers.

During step 6, I specify the IP address of the MariaDB server

Just after this step, I haved checked and all data are correctly stored in config file (/etc/centreon/centreon.conf.php)

 

But at step 7 of the web installation, the process hangs during “Creating database user” with an error (sqlstateq42000]):

No privileges for centreon or centreon_storage databases for centreon user has been found, please check your MySQL configuration

 

In php-fmp error log:   An error with hostCentreon variable

k03-Oct-2022 16:46:50 Europe/Paris] PHP Fatal error:  Uncaught Error: Undefined constant "hostCentreon" in /usr/share/centreon/www/class/centreonDB.class.php:142
Stack trace:
#0 /usr/share/centreon/www/api/internal.php(47): CentreonDB->__construct()
#1 {main}
  thrown in /usr/share/centreon/www/class/centreonDB.class.php on line 142
n03-Oct-2022 16:46:52 Europe/Paris] CRITICAL: Environment variable not found: "hostCentreon". {"context":"{object] (Symfony\\Component\\DependencyInjection\\Exception\\EnvNotFoundException(code: 0): Environment variable not found: \"hostCentreon\". at /usr/share/centreon/vendor/symfony/dependency-injection/EnvVarProcessor.php:172)"}

 

The installation works fine if the database is installed on the local web server.

 

Has anyone had the same problem before?

👋 @Guillaume 

 

Can you confirm that you have:

 

👍


Hello Ponchoh;

Thanks for you answer.

Yes all prerequisites are OK.

On my DB server before the web installation part:

SELECT User, Host FROM mysql.user WHERE Host = 'IP_CENTRAL';
+------+--------------+
| User | Host |
+------+--------------+
| root | IP_CENTRAL |
+------+--------------+
1 row in set (0.001 sec)

And

SHOW GRANTS FOR 'root'@'IP_CENTRAL';
+--------------------------------------------------------------------------------------------------------------------------+
| Grants for root@IP_CENTRAL |
+--------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`IP_CENTRAL` IDENTIFIED VIA mysql_native_password USING '*PASSWORD' OR unix_socket |
+--------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

 

Same commands from the WEB server with mysql root user just created:

mysql -u root -pcentreon -h IP_BDD_SERVER
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 14
Server version: 10.5.16-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB (none)]> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB mysql]> SELECT User, Host FROM mysql.user WHERE Host = 'IP_CENTRAL';
+------+------------+
| User | Host |
+------+------------+
| root | IP_CENTRAL |
+------+------------+
1 row in set (0.001 sec)

MariaDB mysql]> SHOW GRANTS FOR 'root'@'IP_CENTRAL';
+--------------------------------------------------------------------------------------------------------------------------+
| Grants for root@IP_CENTRAL |
+--------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO `root`@`IP_CENTRAL` IDENTIFIED VIA mysql_native_password USING '*PASSWORD' OR unix_socket |
+--------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)

MariaDB mysql]> CREATE DATABASE toto;
Query OK, 1 row affected (0.001 sec)

MariaDB mysql]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| toto |
+--------------------+
4 rows in set (0.000 sec)

MariaDB mysql]>

 

Now, I launch the web installation in my browser.
All paths are the default paths. No change in the 5 first steps.

Step 6:

 

And at Step 7:

 

Always from the web server:

MariaDB amysql]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| centreon |
| centreon_storage |
| information_schema |
| mysql |
| performance_schema |
| toto |
+--------------------+
6 rows in set (0.001 sec)

The 2 databases have been created.

And tables too:

MariaDB amysql]> use centreon
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB acentreon]> SHOW TABLES;
+-----------------------------------------+
| Tables_in_centreon |
+-----------------------------------------+
| ... |
+-----------------------------------------+
164 rows in set (0.001 sec)

MariaDB acentreon]>

 

I don’t understand why process hangs at this steps because rigths and grants seems to be correct ?


This might be it:

 

 

🤞


In fact, it was really the BDD server IP address.
Bad screenshot modification to hide the IP_BDD...


CREATE USER '<USER>'@'<IP>' IDENTIFIED BY '<PASSWORD>';
GRANT ALL PRIVILEGES ON *.* TO '<USER>'@'<IP>' WITH GRANT OPTION;
FLUSH PRIVILEGES;

missing the “ WITH GRANT OPTION “ ?

SELECT User,Host,Grant_priv FROM mysql.user;

 

 


Hi Ponchoh,

Yes, “ WITH GRANT OPTION “ was missing…

A bad copy/paste from the official documentation 😣

Thanks for your sharp look… I don't know how soon I will realize this 🙄


Reply