Database connection “Mysql” is missing and mysql.sock is missing

前端 未结 7 1588
轻奢々
轻奢々 2021-01-12 13:46

I was trying to generate model code from cake command line tool. But got this issue.

Warning Error: PDO::__construct(): [2002] No such file or directory (try         


        
7条回答
  •  孤城傲影
    2021-01-12 14:14

    After searching and trying a lot of things I finally managed to solve my problem. The answer Chuck Burgess given above could solve the problem, but my scenario was little different that I wasn't able to see mysql.sock file at:

        /Applications/MAMP/tmp/mysql/mysql.sock
    

    I thought my mysql.sock was missing but actually it was there and hidden (THAT's STRANGE! I WENT TO THAT FOLDER using CLI AND SAW THAT). I'm using MAC and files starting with '.' are usually HIDDEN but don't know why mysql.sock was hidden so what I did is in my database configuration file I added 1 parameter (unix_socket) and my problem was solved.

       'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'
    

提交回复
热议问题