1

I am following along a youtube tutorial for yii2 and have created a database named yii2crashcoursenew and a table named user with the properties id, username, password, auth_key, access_token and primary key id. I have added one row to the table with the values admin, admin, key1, token1. The code in the config -> db is:

return [
    'class' => 'yii\db\Connection',
    'dsn' => 'mysql:host=localhost;dbname=yii2crashcoursenew',
    'username' => 'root',
    'password' => 'password',
    'charset' => 'utf8'
]

When I type admin, admin in the loginform I get the following error

Database Exception – yii\db\Exception
SQLSTATE[HY000] [2002] No such file or directory
↵
Caused by: PDOException
SQLSTATE[HY000] [2002] No such file or directory
in /Users/webdevelopment/basic/vendor/yiisoft/yii2/db/Connection.php at line 705

Can someone tell me what is wrong and how to solve the issue? Thankyou.

Michael93
  • 109
  • 1
  • 12

0 Answers0