john smith john smith - 1 year ago 106
PHP Question

How to configure MySQL under Zend Framework?

I configured my Zend Framework virtualhost environment, but now my files cannot access the MySQL database. Getting an error:

SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost'.

Where should I configure my MySQL so that it matches my virtualhost?

Answer Source

You need to make sure you are using Zend_Db and you have configured MySQL as you adapter in Zend DB Adapter

Also, in your application.ini file under configs folder,

you must write:

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.adapter = "PDO_MYSQL"
resources.db.params.dbname = "<your database name>" = "<your host name>"
resources.db.params.username = "<mysql username>"
resources.db.params.password = "<mysql password>"
resources.db.params.charset  = "UTF8"

Enjoy coding :)