Jelle De Loecker
Jelle De Loecker

Reputation: 21945

CakePHP database: SQLSTATE 28000 - Error 1045 Access denied for user 'kcal'@'localhost'

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.

Upvotes: 1

Views: 11848

Answers (3)

Sandy
Sandy

Reputation: 2692

Check to see if you have any extra spaces in your login or password. I just had this same issue and it was caused by an extra space at the beginning of the password.

Upvotes: 0

elliot
elliot

Reputation: 772

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;

Upvotes: 3

Arun Jain
Arun Jain

Reputation: 5464

Check the username password you typed in app/Config/database.php. It should looks like:

class DATABASE_CONFIG {

public $default = array(
    'datasource' => 'Database/Mysql',
    'persistent' => false,
    'host' => '127.0.0.1',
    'login' => 'kcal',
    'password' => '---ORIGINIAL PASSWORD HERE---',
    'database' => 'checkpoint_live',
    'prefix' => '',
    'encoding' => 'utf8',
);
}

Upvotes: 0

Related Questions