1

enter image description hereI am importing a MySQL database in shared hosting but I am unable to import the structure of tables properly. After importing, for all tables, there are no primary and foreign keys are coming only data is imported. In between, I will get an error like

1071 - Specified key was too long; max key length is 767 bytes

matheen ulla
  • 526
  • 7
  • 27
  • Does this answer your question? [laravel migration Specified key was too long; max key length is 767 bytes](https://stackoverflow.com/questions/52370510/laravel-migration-specified-key-was-too-long-max-key-length-is-767-bytes) – dvr Nov 18 '19 at 05:49
  • 1
    Does this answer your question? [#1071 - Specified key was too long; max key length is 767 bytes](https://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes) – Dilip Hirapara Nov 18 '19 at 05:49
  • 1
    No, I have tried this. I am unable to import the MySQL database completely. – matheen ulla Nov 18 '19 at 05:59

1 Answers1

1

add this to you AppServiceProvider.

use Schema;

then add this to boot() function

Schema::defaultStringLength(191);

However if you really want to maximize the 255 VARCHAR default length of your database. you need to manage your database setting first.

Kenneth Sunday
  • 865
  • 7
  • 14