php artisan migrate
[IlluminateDatabaseQueryException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table users
(id
int unsigned not null aut
o_increment primary key, name
varchar(255) not null, email
varchar(255) not null, 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 engine = InnoDB R
OW_FORMAT=DYNAMIC)
[PDOException]
SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists
laravel new website
php artisan make:migration create_lists_table --create=lists
php artisan migrate
It Creates users table and give error but not creating lists table
there must be existing table 'users' already created, even before install
This repo is for bug tracking. Use the forums or slack channel for solving your issue
I Solved My Problem Myself
by Changing My create_users_table.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('users');
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
Then close the issue
@niteshkumarniranjan thanks, your solution helped me too, viz, Schema::dropIfExists.
how can we migrate without losing out the data?
drop the database
create it again
php artisan migrate // will create all tables
php artisan make:migration create_test_table // create new migration file for test
php artisan migrate //check if works
it worked or me!
Good Luck
working for me. thank you
Most helpful comment
I Solved My Problem Myself
by Changing My create_users_table.php