Решение Чтобы «Не удалось найти драйвер» & Амп; & quot; не удается подключиться к локальному серверу MYSQL через сокет & quot; — Ларавел

Hi All, Since I'm a newbie to laravel. First time coming to LARAVEL. I Faced lots of problem regarding command like «php artisan migrate».

Ошибка, как,

1

Решение

Прежде всего,

 - Find your php.ini file in your system using $ php -i |grep php\.ini command.
Or, check this https://stackoverflow.com/questions/3057110/where-can-i-find-the-php-ini-for-php-cli
- Open php.ini file.
- And, make sure these lines are present or not.
a)  extension=mysql.so b) extension=pdo_mysql.so
- If Yes, remove (;) this before them.
- If not present, run this command `sudo apt-get install php5-mysql`

Теперь введите php artisan migrate команда. Я уверен, что вы получите ошибку cant connect to local MYSQL server through socket

Now,
- Change bind-address from localhost to 127.0.0.1
- Run `/opt/lampp/bin/php`.
- After running this if you get "unable to load dynamic library", remove `php_mssql.dll extension` (for non-windows)
- If not getting error, come directly to "Project-Name-Folder/config/database.php" file and add this code 'unix_socket'   => '/opt/lampp/var/mysql/mysql.sock',

Найдите полный путь к mysql.sock и добавьте его

'mysql' => [
'driver'    => 'mysql',
'host'      => env('DB_HOST', 'localhost'),
'database'  => env('DB_DATABASE', 'danishLara'),
'username'  => env('DB_USERNAME', 'root'),
'password'  => env('DB_PASSWORD', ''),
'unix_socket'   => '/opt/lampp/var/mysql/mysql.sock', //Add this line here
'charset'   => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix'    => '',
'strict'    => false,
],

Проверь это Настройка Laravel на Mac php artisan ошибка миграции: нет такого файла или каталога

1

Другие решения

Других решений пока нет …