Back

laravel 5.4 migration problem


new laravel 5.4

[email protected]> php artisan migrate                        ~/Desktop/laravel

                                                                               
  [Illuminate\Database\QueryException]                                         
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre  
  ady exists (SQL: create table `users` (`id` int unsigned not null auto_incr  
  ement primary key, `name` varchar(255) not null, `email` varchar(255) not n  
  ull, `password` varchar(255) not null, `remember_token` varchar(100) null,   
  `created_at` timestamp null, `updated_at` timestamp null) default character  
   set utf8mb4 collate utf8mb4_unicode_ci)                                     
                                                                               

                                                                               
  [PDOException]                                                               
  SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' alre  
  ady exists                                                                   
                                                                               

[1] [email protected]>   

php 7.1.0 mariadb-10.1.22-1

lagbox replied 4 months ago

The users table already exists. Stop trying to create it, it already exists.

phpScots replied 3 months ago

First do migrate:refresh to rollback all migrations Then try to migrate.

houzayfarifai replied 3 months ago

delete your database and then php artisan migrate if you tried to migrate it again and shows any error with email go to AppSeriveceProvider and paste this

<?php namespace App\Providers; use Illuminate\Support\ServiceProvider; use Illuminate\Support\Facades\Schema; class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. * * @return void */ public function boot() { Schema::defaultStringLength(191); } /** * Register any application services. * * @return void */ public function register() { // } }
houzayfarifai replied 3 months ago

don't forget to copy the codes above :)

erpwebyazilim replied 3 months ago

2014_10_12_000000_create_users_table.php $table->string('email')->unique(); change $table->string('email', 191)->unique();

2014_10_12_100000_create_password_resets_table.php $table->string('email')->index(); change $table->string('email', 191)->index();


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us