I'm trying to deploy my cakephp project on my virtual machine.
When I type mysql -u root -p
on my VM it works but cakephp seems to not have access to this.
Here is how my DB config looks like:
'Datasources' => [
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => '127.0.0.1',
//'port' => 'non_standard_port_number',
'username' => 'root',
'password' => '',
'database' => 'webarena',
'encoding' => 'utf8',
'timezone' => 'UTC',
'flags' => [],
'cacheMetadata' => true,
'log' => false,
'quoteIdentifiers' => false,
'url' => env('DATABASE_URL', null),
],
And I've got the following error:
SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'
So I tried to set a new password by doing so:
mysql> UPDATE mysql.user SET Password=PASSWORD('SecurePassword') WHERE
User='root';
mysql> FLUSH PRIVILEGES;
mysql> EXIT
But still doesn't work.
I can also type mysql
and it works? How's that possible?