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:
- [Solved] Artisan error: SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes
- Laravel5.5 Error: SQLSTATE[42000] Syntax error or access violation 1071 Specified key was too long; max k
- Laravel-admin php artisan admin:install error reporting problem solution
- PHP parse error: syntax error, unexpected ‘use’
- PHP large file upload error 413: request entity too large [How to Solve]
- [PHP] Solve the limitation of uploading files in nginx php 413 Request Entity Too Large
- Syntax error: typeerror: about installing sass in vue3 this.getOptions is not a function
- [Solved] PHP post Datas json_decode Error: 4 JSON_ERROR_SYNTAX
- [Solved] has been blocked by CORS policy: Response to preflight request doesn‘t pass access control check: No
- Error while injecting dependencies into App\Controller\IndexController: No entry or class found for
- composer Error: The requested PHP extension ext-bcmath * is missing from your system. Install or enable
- Mac installs the php Swoole extension and appears Enable openssl support, require openssl library or fatal error:’openssl/ssl.h’ file not found
- Error during session start; please check your PHP and/or webserver log file and configure your PHP
- /www/server/php/56/sbin/php-fpm:error while loading shared libraries:libssl.so.1.0. 0:cannot open shared object file:No such file or directory
- Undefined index: name error in composer [How to Solve]
- [PHP] __autoload function will be called when class_exists does not exist
- [Solved] Model Error: must return a relationship instance
- PHP use __Sleep() and __wakeup() method serializes the object
- PHP: How to parse MHT file into HTML
- [Solved] yii error: Setting unknown property: yii\console\Request: :cookieValidationKey