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

3

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

if 255 link doesn't matter to you. you can add the schema setting to your AppServiceProvider class.
what mysql version are you using. i'll guess . its Mysql 8 ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.