Rumah  >  Soal Jawab  >  teks badan

Laravel 8: Selesaikan masalah php artisan migrate tidak berfungsi

Semuanya baik sehingga saya menukar komputer. Saya cuba memindahkan pangkalan data saya menggunakan php artisan migrate tetapi saya mendapat ralat ini

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))

Sebarang percubaan untuk berinteraksi dengan pangkalan data memberi saya ralat yang sama

Ini ialah konfigurasi .env saya

DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=grain
    DB_USERNAME=root
    DB_PASSWORD=

P粉885035114P粉885035114176 hari yang lalu318

membalas semua(1)saya akan balas

  • P粉794851975

    P粉7948519752024-03-31 00:14:58

    Masalahnya ialah kerana pada komputer lama saya, saya menggunakan MAMP dan sekarang saya menggunakan XAMPP, jadi laluan dalam database.php 文件中 unix_socket adalah salah.

    Jadi pergi ke my.cnf 文件并搜索套接字路径,然后确保该套接字路径与 unix_socket 文件中的 database. jalan yang sama

    balas
    0
  • Batalbalas