I was asked to create a CRUD APP with Laravel and Mysql from a potential employer but I’m getting an error when I run: <pre>php artisan migrate</pre> I’ve read all links on the first page of Google and Duckduckgo already but I couldn’t find the answer to my problem.

The errors when I run php artisan migrate is:

Illuminate\Database\QueryException  : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = Laravel-tasks and table_name = migrations)

  at /Users/my_username/PHP/todo/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668|

  Exception trace:

  1   PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]")
      /Users/my_username/PHP/todo/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=Laravel-tasks", "root", "YGM4QV6kWnjz3uN!", [])
      /Users/my_username/PHP/todo/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70

This is the command line I executed inside my project folder<pre>php artisan make:migration create_tasks_table</pre>

This is the code on the create_tasks_table.php:

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;


class CreateTasksTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('tasks', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('tasks');
    }
}

The Database on the .env is:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=Laravel-tasks
DB_USERNAME=root
DB_PASSWORD=*****

Hoping for your experienced responses!

Cheers!

This post is also available on DEV.