Laravel 8: php artisan 마이그레이션이 작동하지 않는 문제 해결
P粉885035114
P粉885035114 2024-03-30 17:41:04
0
1
337

컴퓨터를 바꾸기 전까지는 모든 것이 괜찮았습니다. php artisan migrate를 사용하여 데이터베이스를 마이그레이션하려고 하는데 이 오류가 발생합니다

으아악

데이터베이스와 상호 작용하려고 하면 동일한 오류가 발생합니다

이것은 내 .env 구성입니다

SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from information_schema.tables where table_schema = grain and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }

      +33 vendor frames 
  34  artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

P粉885035114
P粉885035114

모든 응답(1)
P粉794851975

문제는 이전 컴퓨터에서 MAMP를 사용하고 있었고 지금은 XAMPP를 사용하고 있기 때문에 database.php 文件中 unix_socket의 경로가 잘못되었다는 것입니다.

그러니 my.cnf 文件并搜索套接字路径,然后确保该套接字路径与 unix_socket 文件中的 database.같은 길

으로 가세요
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!