[Solved] PDOException::(“SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long;

php artisan migrate Run Error:
PDOException:: (“SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes”)

Solution:
Add the following codes in the file of app/Providers/AppSeviceProvider.php:
use Illuminate\Support\Facades\Schema;
Add in the method of foot:
Schema::defaultStringLength(191);

<?php

namespace App\Providers;

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
		Schema::defaultStringLength(191);
    }
}

After the prompt
pdoexception:: (“sqlstate [42s01]: base table or view already exists: 1050 table ‘users’ already exists”)
, delete the user table and re-run PHP artist migrate

Read More: