1. Scene
- Version:Laravel 5.7
- Project downloaded from github, installed locally.
1. Create a new database
2. Execute the data table generation command in the project root directory (non-public directory) , and an php artisan migrateerror is reported:Syntax error or access violation: 1071 Specified key was too long
2. Screenshot of error reporting
- The migrations table was successfully generated
- An error was reported when generating the user table
- So there are 2 tables in the database, migrations and user table

3. Solution
- Open
app/prpvider/appserviceprovider.phpfile - Find the
boot()method - Set the default length of the string:
Schema::defaultStringLength(191); - The screenshot is as follows:

4. Re-execute PHP artisan migrate again
- The error message is as follows:

- Delete the migrations and user tables in conflict.
- execute again:
php artist migratethe data table is created successfully, as shown in the following figure:
