2
votes

I have the following error upon doing:

php artisan migrate

Error:

Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authenti cation method unknown to the client (SQL: select * from information_schema.tables where table _schema = d1 and table_name = migrations)

Here's a screenshot;

enter image description here

PS. Just in case: I've enabled the "extension=pdo_mysql" in my php.ini file.

Any ideas how to fix this?

3

3 Answers

4
votes

Hi as mentioned in this post:

Laravel-news

it is a typical windows problem.

The mentioned solution is:

use Illuminate\Support\Facades\Schema;

public function boot()
{
    Schema::defaultStringLength(191);
}

inside the AppServiceProvider.php

0
votes

I have also been stuck on this for quite some time. One solution that worked for me was to open Connection.php and either comment out the exceptions or replace those exceptions so that there is no error when php migrate is run. This worked for me. Let me know if you find any other solutions/any changes.

Alternatively, and perhaps a better solution:

In database.php, found under app/config, add this:

'connections' => [

    'mysql' => [
        'driver'      => 'mysql',
        'host'        => env( 'DB_HOST', '127.0.0.1' ),
        'port'        => env( 'DB_PORT', '3306' ),
        'database'    => env( 'DB_DATABASE', 'forge' ),
        'username'    => env( 'DB_USERNAME', 'forge' ),
        'password'    => env( 'DB_PASSWORD', '' ),
        'unix_socket' => env( 'DB_SOCKET', '' ),
        'charset'     => 'utf8mb4',
        'collation'   => 'utf8mb4_unicode_ci',
        'prefix'      => '',
        'strict'      => true,
        'engine'      => null,
        'modes'       => [
            'ONLY_FULL_GROUP_BY',
            'STRICT_TRANS_TABLES',
            'NO_ZERO_IN_DATE',
            'NO_ZERO_DATE',
            'ERROR_FOR_DIVISION_BY_ZERO',
            'NO_ENGINE_SUBSTITUTION',
        ],
    ],
],
-1
votes

Been struggling with this problem too. I think it's better to drop and then migrate again the tables first before adding a new table or any changes to your migrations folder. I hope this will solve your problem..

php artisan migrate:fresh