Answer the question
In order to leave comments, you need to log in
Why does the database migration fail?
Hello everybody! Please explain why the error shown below occurs when migrating a database to a project:
In the process of restoring the dump occurred error: SQLSTATE[HY000] [1045] Access denied for user 'shop'@'localhost' (using password: YES)
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=fedorov_shop',
'username' => 'fedorov_shop',
'password' => '***',
'charset' => 'utf8',
'enableSchemaCache' => true,
'schemaCacheDuration' => 3600,
Answer the question
In order to leave comments, you need to log in
Access denied for user 'shop '@'localhost'
Good morning.
Which template are you using, advanced or base?
Are there any other configs?
During migration, you can explicitly specify which database to migrate to.
In the config file
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=fedorov_shop',
'username' => 'fedorov_shop',
'password' => '***',
'charset' => 'utf8',
'enableSchemaCache' => true,
'schemaCacheDuration' => 3600,
]
public function init()
{
$this->db = 'db2';
parent::init();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question