PDOException SQLSTATE[HY000] [2002] No such file or directory

后端 未结 30 3015
南方客
南方客 2020-11-22 03:23

I believe that I\'ve successfully deployed my (very basic) site to fortrabbit, but as soon as I connect to SSH to run some commands (such as php artisan migrate

30条回答
  •  萌比男神i
    2020-11-22 03:48

    Step 1

    Find the path to your unix_socket, to do that just run netstat -ln | grep mysql

    You should get something like this

    unix  2      [ ACC ]     STREAM     LISTENING     17397    /var/run/mysqld/mysqld.sock
    

    Step 2

    Take that and add it in your unix_socket param

    'mysql' => array(
                'driver'    => 'mysql',
                'host'      => '67.25.71.187',
                'database'  => 'dbname',
                'username'  => 'username',
                'password'  => '***',
                'charset'   => 'utf8',
                'collation' => 'utf8_unicode_ci',
                'prefix'    => '',
                'unix_socket'    => '/var/run/mysqld/mysqld.sock' <-----
                ),
            ),
    

    Hope it helps !!

提交回复
热议问题