Mysql – CakePHP database: SQLSTATE 28000 – Error 1045 Access denied for user ‘kcal’@’localhost’

cakephpMySQL

I'm moving my websites from a little VPS to a big dedicated server. But this is one strange problem.

I keep getting this error:

Missing Database Connection

Error: SQLSTATE[28000] [1045] Access denied for user 'kcal'@'localhost' (using password: YES) requires a database connection

Error: Confirm you have created the file : app/Config/database.php.

Notice: If you want to customize this error message, create app/View/Errors/missing_connection.ctp.

Yes: the file has been created, the user has been made, the password is correct. (I even changed it to something simple. Twice)

Yet I still get this error.

I read I need the pdo_mysql extension, but that's installed by default. I have it, it's installed and enabled!

All my other applications work fine. This is the only CakePHP one, though.

Best Answer

An access denied error indicates exactly that - Cake is able to talk to MySQL, and it's saying access is denied with the user@host indicated. Proabbly because the user doesn't have access to the checkpoint_live database.

Since you just moved to a new server, you probably need to grant privileges on the MySQL table for that particular user@host. Creating the same user with the same password isn't enough. Try this:

GRANT ALL PRIVILEGES ON checkpoint_live.* TO 'kcal'@'localhost';
FLUSH PRIVILEGES;