Advertisement
wdtobibur

Database max key length

Mar 19th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. Laravel database key length problem solve code here....
  2. Problem: [PDOException] SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 byte
  3. Web site solve link : https://stackoverflow.com/questions/42244541/laravel-migration-error-syntax-error-or-access-violation-1071-specified-key-wa
  4. Add the following code to AppServiceProvider.php
  5. File location: app/Providers/AppServiceProvider.php
  6.  
  7. use Illuminate\Support\Facades\Schema; //Import Schema
  8. function boot()
  9. {
  10.     Schema::defaultStringLength(191); //Solved by increasing StringLength
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement