0

I got an error when I'm migrating. I already create the database Book_Store here is the .env

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

Here is the migration

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCategoriesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('categories', function (Blueprint $table) {
            $table->id(20);
            $table->string('category', 255);
            $table->timestamps();
        });
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('categories');
    }
}

Here are the error that I got

   Illuminate\Database\QueryException 
  SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = Book_Store and table_name = migrations and table_type = 'BASE TABLE')
  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:703
    699▕         // If an exception occurs when attempting to run a query, we'll format the error
    700▕         // message to include the bindings with SQL, which will make this exception a
    701▕         // lot more helpful to the developer instead of just the database's errors.
    702▕         catch (Exception $e) {
  ➜ 703▕             throw new QueryException(
    704▕                 $query, $this->prepareBindings($bindings), $e
    705▕             );
    706▕         }
    707▕     }
      +33 vendor frames 
  34  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

I have no idea why I got this error, I have make the database and make sure in .env the name is correct, I've also try to change the host to localhost but it's still showing the error.

Gisela
  • 1
  • After completion of any .env edit, must be clear cache: php artisan config:cache If you fixed everything and still have an error then stop XAMPP and restart Apache and MySQL server – Sandhya Srishti Nov 30 '21 at 03:29
  • Thank you for your help. I've try it but it is still have the same error – Gisela Nov 30 '21 at 05:07
  • https://stackoverflow.com/questions/33260172/sqlstatehy000-2002-php-network-getaddresses-getaddrinfo-failed-nodename-no/66910286#66910286 try this – Sandhya Srishti Nov 30 '21 at 11:56
  • I have tried everything and it's still showing the same error – Gisela Dec 08 '21 at 05:25

0 Answers0