[ZM API] Database connection "Mysql" is missing, or could not be created
Posted: Sat Feb 02, 2019 1:56 pm
Hi,
When i call in the Browser "http://server01/zm/api/monitors.json", i get the following issue:
error.log:
Does anyone know, how to fix this?
When i call in the Browser "http://server01/zm/api/monitors.json", i get the following issue:
Code: Select all
{ "code": 500, "name": "Database connection "Mysql" is missing, or could not be created.", "message": "SQLSTATE[HY000] [2002] ", "url": "\/zm\/api\/monitors.json" }
Code: Select all
2019-02-02 13:52:29 Error: [MissingConnectionException] Database connection "Mysql" is missing, or could not be created.
Exception Attributes: array (
'class' => 'Mysql',
'message' => 'SQLSTATE[HY000] [2002] ',
'enabled' => true,
)
Request URL: /zm/api/monitors.json
Stack Trace:
#0 /usr/share/zoneminder/www/api/lib/Cake/Model/Datasource/DboSource.php(271): Mysql->connect()
#1 /usr/share/zoneminder/www/api/lib/Cake/Model/ConnectionManager.php(105): DboSource->__construct(Array)
#2 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(3646): ConnectionManager::getDataSource('default')
#3 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(1162): Model->setDataSource('default')
#4 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(3673): Model->setSource('Monitors')
#5 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(1394): Model->getDataSource()
#6 /usr/share/zoneminder/www/api/app/Plugin/CakePHP-Enum-Behavior/Model/Behavior/EnumBehavior.php(34): Model->schema()
#7 /usr/share/zoneminder/www/api/lib/Cake/Model/BehaviorCollection.php(145): EnumBehavior->setup(Object(Monitor), Array)
#8 /usr/share/zoneminder/www/api/lib/Cake/Model/BehaviorCollection.php(66): BehaviorCollection->load('CakePHP-Enum-Be...', Array)
#9 /usr/share/zoneminder/www/api/lib/Cake/Model/Model.php(781): BehaviorCollection->init('Monitor', Array)
#10 [internal function]: Model->__construct(NULL)
#11 /usr/share/zoneminder/www/api/lib/Cake/Utility/ClassRegistry.php(169): ReflectionClass->newInstance(Array)
#12 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(741): ClassRegistry::init('Monitor')
#13 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(368): Controller->loadModel('Monitor')
#14 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(406): Controller->__isset('Monitor')
#15 /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Component/CrudComponent.php(812): Controller->__get('Monitor')
#16 /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Component/CrudComponent.php(614): CrudComponent->_setModelProperties()
#17 /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Component/CrudComponent.php(751): CrudComponent->getSubject()
#18 /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Component/CrudComponent.php(728): CrudComponent->_loadListener('RelatedModels')
#19 /usr/share/zoneminder/www/api/app/Plugin/Crud/Controller/Component/CrudComponent.php(169): CrudComponent->_loadListeners()
#20 /usr/share/zoneminder/www/api/lib/Cake/Utility/ObjectCollection.php(128): CrudComponent->initialize(Object(MonitorsController))
#21 /usr/share/zoneminder/www/api/lib/Cake/Event/CakeEventManager.php(243): ObjectCollection->trigger('initialize')
#22 /usr/share/zoneminder/www/api/lib/Cake/Controller/Controller.php(677): CakeEventManager->dispatch(Object(CakeEvent))
#23 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(189): Controller->startupProcess()
#24 /usr/share/zoneminder/www/api/lib/Cake/Routing/Dispatcher.php(167): Dispatcher->_invoke(Object(MonitorsController), Object(CakeRequest))
#25 /usr/share/zoneminder/www/api/app/webroot/index.php(107): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))
#26 {main}