1

The error:(occurring in the prod env)

request.CRITICAL: PDOException: SQLSTATE[28000] [1045] Access denied for user 'root'@'localhost' (using password: YES) (uncaught exception) at /srv/inta/current/vendor/doctrine-dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php line 36 [] []

What I've tried so far

The weird thing is that I actually have access using the root user, and the provided password. Logging in as root via the console works great.

I'm using the following parameters.yml file located in app/config/

parameters:
    database_driver:   pdo_mysql
    database_host:     localhost
    database_port:     ~
    database_name:     int_apartments
    database_user:     root
    database_password: pw goes here

    mailer_transport:  smtp
    mailer_host:       localhost
    mailer_user:       ~
    mailer_password:   ~

    locale:            en
    secret:            ThisTokenIsNotSoSecretChangeIt

As you can see, it is quite standard with only the name of the db, user and password changed.

In my config.yml located in app/config (the relevant portions)

imports:
- { resource: security.yml }
- { resource: parameters.yml }

...

doctrine:
   dbal:
      driver:   %database_driver%
      host:     %database_host%
      port:     %database_port%
      dbname:   %database_name%
      user:     %database_user%
      password: %database_password%
      charset:  UTF8
      dbname:   int_apartments

  orm:
      auto_generate_proxy_classes: %kernel.debug%
      auto_mapping: true
      mappings:
          StofDoctrineExtensionsBundle: false

Now, I wanted to start at "step 1" and verify that the parameters.yml file is actually being imported, so I changed the host to "localhos" or the user to "tom" or whatever and the error message located in app/logs/prod.log stays exact as is - the location doesn't change and the user doesn't change.

So I checked my config_prod.yml located in app/config

imports:
- { resource: config.yml }


#doctrine:
#    metadata_cache_driver: apc
#    result_cache_driver: apc
#    query_cache_driver: apc

monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: error
            handler:      nested
        nested:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug

...and everything seems standard!

Summary of what's going on

So here is the quick version.

  • Authentication error exists for root@localhost
  • Verified my authentication creditials by logging in as that user via the console
  • Want to check if the parameters.yml file is being loaded
  • Changed some values - none affected the error message

(small)Edit: What I actually want to do is to connect to the DB as a completely different user with a different password. Even when I enter different credentials into my parameters.yml file, doctrine still spits out the "root@localhost" error.

Ideas?

2
  • Does your password contain any special characters? Commented Jul 15, 2012 at 12:17
  • The password is only A-z 0-9 currently Commented Jul 15, 2012 at 12:18

2 Answers 2

2

Silly mistake, seems due to a bad user/group/owner configuration on the server.

the app/cache directory is owned by "root", but when I run app/console cache:clear --env=prod --no-debug I am running as another user (not root). So there were issues in clearing the cache and doctrine seems to have been using a very old configuration located in the cache files.

Lessons learned:

  • Always try running as root (as a last resort)
  • Use a properly configured web server to avoid ownership issues
Sign up to request clarification or add additional context in comments.

1 Comment

Yes! Please cache:clear! The doctrine is caching the credentials somewhere. I tried so many things and this simple fix did it. Thank you!
1

I solved my problem by renaming the prod folder i uploaded to prod_old because the system could not delete the folder for some reason.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.