Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

SQLSTATE[28000] [1045] Access denied for user...

As a phalcon-beginner I cloned the application "invo" and added my own tables and models. The app is working fine on my local XAMPP (PHP 7.2.5 and Phalcon 3.4.0).

At my Internet provider (PHP 7.2.8 and Phalcon 3.3.2) the app with adapted config.ini and MySQL-DB shows the start page, then on login as a user says "Internal Error" and stops (error log follows):

SQLSTATE[28000] [1045] Access denied for user 'dimatoo1_invo1'@'localhost' (using password: YES):

#0 [internal function]: PDO->__construct('mysql:host=loca...', 'dimatoo1_invo1', '[pwd here]', Array)
#1 [internal function]: Phalcon\Db\Adapter\Pdo->connect(Array)
#2 /home/dimatoo1/public_html/support/app/Services.php(88): Phalcon\Db\Adapter\Pdo->__construct(Array)
#3 [internal function]: Services->initSharedDb()
#4 [internal function]: Phalcon\Di\Service->resolve(NULL, Object(Services))
#5 [internal function]: Phalcon\Di->get('db', NULL)
#6 [internal function]: Phalcon\Di->getShared('db')
#7 [internal function]: Phalcon\Mvc\Model\Manager->_getConnection(Object(Users), NULL)
#8 [internal function]: Phalcon\Mvc\Model\Manager->getReadConnection(Object(Users))
#9 [internal function]: Phalcon\Mvc\Model->getReadConnection()
#10 [internal function]: Phalcon\Mvc\Model\MetaData\Strategy\Introspection->getMetaData(Object(Users), Object(Services))
#11 [internal function]: Phalcon\Mvc\Model\MetaData->_initialize(Object(Users), 'users-users', 'users', '')
#12 [internal function]: Phalcon\Mvc\Model\MetaData->readMetaData(Object(Users))
#13 [internal function]: Phalcon\Mvc\Model\MetaData->hasAttribute(Object(Users), 'email')
#14 [internal function]: Phalcon\Mvc\Model\Query->_getQualified(Array)
#15 [internal function]: Phalcon\Mvc\Model\Query->_getExpression(Array, true)
#22 [internal function]: Phalcon\Mvc\Model\Query->_prepareSelect()
#23 [internal function]: Phalcon\Mvc\Model\Query->parse()
#24 [internal function]: Phalcon\Mvc\Model\Query->execute()
#25 /home/dimatoo1/public_html/support/app/controllers/SessionController.php(56): Phalcon\Mvc\Model::findFirst(Array)
#26 [internal function]: SessionController->startAction()
#27 [internal function]: Phalcon\Dispatcher->callActionMethod(Object(SessionController), 'startAction', Array)
#28 [internal function]: Phalcon\Dispatcher->dispatch()
#29 /home/dimatoo1/public_html/support/public/index.php(28): Phalcon\Mvc\Application->handle(NULL)
#30 {main}

I dont know where to find the problem. Is the PDO constructor incorrect or are perhaps the PHP and Phalcon versions not compatible? Every help is greatly appreciated! Marc


mysql users has user,password and host. All 3 must pass in order for auth to be success. I bet your user host has something set. u can use % for every host

edited Aug '18

Tank you for your response. My provider wants 'localhost' as host. So my config file looks like that:

adapter  = Mysql
host     = localhost
username = dimatoo1_invo1
password = [pwd]
dbname   = dimatoo1_invo
charset  = utf8

But I wonder where the DBname is in the above-named error.log? Are the parameters in the PDO constructor correct?


there is a plain text error, so the config should be fine. As i said the mysql itself gives you that error, because it cannot authorise you ( bad user/pass/hostname)


there is a plain text error, so the config should be fine. As i said the mysql itself gives you that error, because it cannot authorise you ( bad user/pass/hostname)

Sorry Izo, you are right, I made an embarrassing error saving the passwort not in the correct file! Thank you and best regards! Marc