2

So I just downloaded yii2 project from server using Winscp to run it in my local, but when I run it gives me the error: CDbConnection failed to open the DB connection: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO). I've checked the user privileges and I've grant all privileges. (user table mysql).

Here's the main.php:

'db'=>array(
        'connectionString' => 'mysql:host=127.0.0.1;dbname=serena',
        'emulatePrepare' => true,
        'username' => 'root',
        'password' => '',
        'charset' => 'utf8',
    ),
4
  • 2
    using password: NO ? (First off, please set a password for root for security, and please create a separate mysql user account with password and necessary privileges for accessing the db) Commented Feb 8, 2023 at 3:04
  • still gives me error. Access denied for user 'tommy'@'localhost' (using password: YES) Commented Feb 8, 2023 at 3:11
  • I've checked all privileges and grant it all Commented Feb 8, 2023 at 3:12
  • Does this answer your question? SQLSTATE[HY000] [1045] Access denied for user 'test'@'localhost' (using password: YES) Commented Feb 9, 2023 at 10:34

1 Answer 1

0

I just adding the port because I have different port.

 'connectionString' => 'mysql:host=127.0.0.1;dbname=serena;port=8111',
Sign up to request clarification or add additional context in comments.

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.