smarber
smarber

Reputation: 5084

propel:database:create access denied for user 'user'@'localhost'

For my Symfony2 project, I'm using Propel with MySQL.

When I deployed it on a server and ran:

php app/console propel:database:create --env=prod

I got this error:

[Propel] Exception caught

Unable to open PDO connection [wrapped: SQLSTATE[28000] [1045] Access denied for user 'user'@'localhost' (using password: YES)]

Which is really weird because when I run MySQL CLI with exactly the same host, user and password it works fine.

$ mysql -h localhost -u user -p

Propel-bundle: 1.2.13

What's going on?

Upvotes: 0

Views: 630

Answers (1)

mysqlrockstar
mysqlrockstar

Reputation: 2612

Try these steps

  1. Configure config/databases.yml with the working username and password. Ensure you are using the correct password and port here
propel:
    class: sfPropelDatabase
    param:
      classname: PropelPDO
      dsn: 'mysql:dbname=your-database-name;host=localhost'
      port :  3306
      username:         user
      password :        your-password
      encoding:         utf8
      persistent:       true
      pooling:          true
  1. Disable SELnux: If SELinux is enabled which can block the connection. Try to disable that, although not the optimal for those that like of security on their systems

Upvotes: 1

Related Questions