I install laravel 5.5 and When I run php artisan migrate
show me this error
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQ
L: alter tableusers
add uniqueusers_email_unique
(
And I add below code on AppServiceProvider.php
public function boot()
{
Schema::defaultStringLength(191); //Solved by increasing StringLength
}
And then show me this error
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created_at' (SQL: create table(
password_resetstoken
varchar(191) not null,created_at
timestamp not null) de
fault character set utf8mb4 collate utf8mb4_unicode_ci)
Best Answer
You can use
nullableTimestamps()
instead oftimestamps()
or
also check the database server version
Please have a look on these ref links:
https://github.com/laravel/framework/issues/3602
https://laracasts.com/discuss/channels/forge/syntax-error-or-access-violation-1067-invalid-default-value-for-created-at