PDO Connection Error: SQLSTATE[HY000] [1045] Access denied for user 'icinga'@'localhost' (using password: YES)

3.5k views Asked by At

I installed icinga-web on amazon aws instance and when I open icinga-web in my browser, I see messages in yellow boxes that "Request failed" and when I go to console and click on that error I got stacktrace like this

PDO Connection Error: SQLSTATE[HY000] [1045] Access denied for user 'icinga'@'localhost' (using password: YES)
Stacktrace:
#0 /usr/local/icinga-web/lib/doctrine/lib/Doctrine/Connection/Mysql.php(101): Doctrine_Connection->connect()
#1 /usr/local/icinga-web/lib/doctrine/lib/Doctrine/Connection.php(1009): Doctrine_Connection_Mysql->connect()
#2 /usr/local/icinga-web/lib/doctrine/lib/Doctrine/Query/Abstract.php(976): Doctrine_Connection->execute('SELECT i.progra...', Array)
#3 /usr/local/icinga-web/app/modules/Api/lib/database/IcingaDoctrine_Query.class.php(116): Doctrine_Query_Abstract->_execute(Array)
#4 /usr/local/icinga-web/lib/doctrine/lib/Doctrine/Query/Abstract.php(1026): IcingaDoctrine_Query->_execute(Array)
#5 /usr/local/icinga-web/app/modules/Cronks/models/Provider/ProgramStatusModel.class.php(103): Doctrine_Query_Abstract->execute()
#6 /usr/local/icinga-web/app/modules/Cronks/models/Provider/ProgramStatusModel.class.php(88): Cronks_Provider_ProgramStatusModel->refresh()
#7 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(441): Cronks_Provider_ProgramStatusModel->initialize(Object(AppKitAgaviContext), Array)
#8 /usr/local/icinga-web/app/modules/Cronks/models/Provider/SystemPerformanceModel.class.php(36): AgaviContext->getModel('Provider/Progra...', 'Cronks')
#9 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(441): Cronks_Provider_SystemPerformanceModel->initialize(Object(AppKitAgaviContext), Array)
#10 /usr/local/icinga-web/app/modules/Cronks/views/System/MonitorPerformanceSuccessView.class.php(35): AgaviContext->getModel('Provider/System...', 'Cronks')
#11 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1672): Cronks_System_MonitorPerformanceSuccessView->executeJson(Object(AgaviWebRequestDataHolder))
#12 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1533): AgaviExecutionFilter->executeView(Object(AgaviExecutionContainer))
#13 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1255): AgaviExecutionFilter->execute(Object(AgaviFilterChain), Object(AgaviExecutionContainer))
#14 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1700): AgaviFilter->executeOnce(Object(AgaviFilterChain), Object(AgaviExecutionContainer))
#15 /usr/local/icinga-web/lib/agavi/src/filter/AgaviSecurityFilter.class.php(73): AgaviFilterChain->execute(Object(AgaviExecutionContainer))
#16 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1255): AgaviSecurityFilter->execute(Object(AgaviFilterChain), Object(AgaviExecutionContainer))
#17 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1700): AgaviFilter->executeOnce(Object(AgaviFilterChain), Object(AgaviExecutionContainer))
#18 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(870): AgaviFilterChain->execute(Object(AgaviExecutionContainer))
#19 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1266): AgaviExecutionContainer->execute()
#20 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1255): AgaviDispatchFilter->execute(Object(AgaviFilterChain), Object(AgaviExecutionContainer))
#21 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1700): AgaviFilter->executeOnce(Object(AgaviFilterChain), Object(AgaviExecutionContainer))
#22 /usr/local/icinga-web/lib/agavi/src/filter/AgaviFormPopulationFilter.class.php(78): AgaviFilterChain->execute(Object(AgaviExecutionContainer))
#23 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(1700): AgaviFormPopulationFilter->executeOnce(Object(AgaviFilterChain), Object(AgaviExecutionContainer))
#24 /usr/local/icinga-web/app/cache/config/compile.xml_production__119920113a175a2dcea22e33a36de83ba298e663.php(579): AgaviFilterChain->execute(Object(AgaviExecutionContainer))
#25 /usr/local/icinga-web/pub/index.php(49): AgaviController->dispatch()
#26 {main}

What should I have to do to solve this?

Thank you

2

There are 2 answers

0
Nordennavic On

You need add privileges to the icinga user in MySQL:

GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTE ON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';
FLUSH PRIVILEGES;
0
cflinspach On

Your MySQL credentials are wrong in Icinga. You can check them and even test the connection under Configuration -> Application -> Resources.

IcingaWeb2 Resources

It could also be that your db doesn't have the Icinga user or access. Do a SHOW GRANTS in MySQL to check.