PHP Fatal error: Uncaught exception 'Exception' with message 'Could not connect to database! SQLSTATE[28000] [1045] Access denied for user 'phpipam'@'localhost' (using password: YES)' in /var/www/html/phpipam/functions/classes/class.PDO.php:159
We are trying to do Automatic host availability and discovery check by following this document https://phpipam.net/news/automatic-host-availability-check/.
Here is the full error related to php script:
/usr/bin/php /var/www/html/phpipam/functions/scripts/pingCheck.php PHP Fatal error: Uncaught exception 'Exception' with message 'Could not connect to database! SQLSTATE[28000] [1045] Access denied for user 'phpipam'@'localhost' (using password: YES)' in /var/www/html/phpipam/functions/classes/class.PDO.php:159 Stack trace: #0 /var/www/html/phpipam/functions/classes/class.PDO.php(1053): DB->connect() #1 /var/www/html/phpipam/functions/classes/class.PDO.php(298): Database_PDO->connect() #2 /var/www/html/phpipam/functions/classes/class.Common.php(236): DB->escape('id') #3 /var/www/html/phpipam/functions/classes/class.Common.php(411): Common_functions->fetch_object('settings', 'id', 1) #4 /var/www/html/phpipam/functions/classes/class.Log.php(292): Common_functions->get_settings() #5 /var/www/html/phpipam/functions/classes/class.Subnets.php(120): Logging->__construct(Object(Database_PDO)) #6 /var/www/html/phpipam/functions/scripts/pingCheck.php(38): Subnets->__construct(Object(Database_PDO)) #7 {main} thrown in /var/www/html/phpipam/functions/classes/class.PDO.php on line 159
Any help is appreciated.
Hello, I was on the same problem for almost a day... The solution for me was simple, I writted incorrectly the environments variables : IPAM_DATABASE_HOST. Check yours and with that, the name of your value. Is it correct too ? It could be the same with IPAM_DATABASE_PASS. Do not put any quotes on your password. (inside the phpipam-cron container variables)
- IPAM_DATABASE_USER=phpipam
- IPAM_DATABASE_PASS=phpipampassword
Cheers.