Error while migrating database (Laravel): table already exists





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I have installed Laravel's auth and chatter forum package. When I tried to migrate the database, I got this error:




Migrating: 2014_10_12_000000_create_users_table

IlluminateDatabaseQueryException : SQLSTATE[42S01]: Base table or view alr eady exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` va rchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb 4_unicode_ci')

at C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDatabas eConnection.php:664

660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make th is exception a
662| // lot more helpful to the developer instead of just the databa se's errors.
663| catch (Exception $e) {
664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|

Exception trace:

1 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 T able 'users' already exists")
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

2 PDOStatement::execute()
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

Please use the argument -v to see more details.


I tried to migrate with the command:



php artisan migrate









share|improve this question

























  • Since Users already exists, find that file and comment out everything in the Up function. This will allow the migration to continue without deleting the file.

    – aynber
    Jan 3 at 13:53


















1















I have installed Laravel's auth and chatter forum package. When I tried to migrate the database, I got this error:




Migrating: 2014_10_12_000000_create_users_table

IlluminateDatabaseQueryException : SQLSTATE[42S01]: Base table or view alr eady exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` va rchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb 4_unicode_ci')

at C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDatabas eConnection.php:664

660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make th is exception a
662| // lot more helpful to the developer instead of just the databa se's errors.
663| catch (Exception $e) {
664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|

Exception trace:

1 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 T able 'users' already exists")
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

2 PDOStatement::execute()
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

Please use the argument -v to see more details.


I tried to migrate with the command:



php artisan migrate









share|improve this question

























  • Since Users already exists, find that file and comment out everything in the Up function. This will allow the migration to continue without deleting the file.

    – aynber
    Jan 3 at 13:53














1












1








1








I have installed Laravel's auth and chatter forum package. When I tried to migrate the database, I got this error:




Migrating: 2014_10_12_000000_create_users_table

IlluminateDatabaseQueryException : SQLSTATE[42S01]: Base table or view alr eady exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` va rchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb 4_unicode_ci')

at C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDatabas eConnection.php:664

660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make th is exception a
662| // lot more helpful to the developer instead of just the databa se's errors.
663| catch (Exception $e) {
664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|

Exception trace:

1 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 T able 'users' already exists")
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

2 PDOStatement::execute()
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

Please use the argument -v to see more details.


I tried to migrate with the command:



php artisan migrate









share|improve this question
















I have installed Laravel's auth and chatter forum package. When I tried to migrate the database, I got this error:




Migrating: 2014_10_12_000000_create_users_table

IlluminateDatabaseQueryException : SQLSTATE[42S01]: Base table or view alr eady exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` va rchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb 4_unicode_ci')

at C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDatabas eConnection.php:664

660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make th is exception a
662| // lot more helpful to the developer instead of just the databa se's errors.
663| catch (Exception $e) {
664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|

Exception trace:

1 PDOException::("SQLSTATE[42S01]: Base table or view already exists: 1050 T able 'users' already exists")
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

2 PDOStatement::execute()
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba seConnection.php:458

Please use the argument -v to see more details.


I tried to migrate with the command:



php artisan migrate






php mysql laravel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 4 at 11:00









JJJ

29.3k147693




29.3k147693










asked Jan 3 at 13:51









Mario MlinarićMario Mlinarić

258




258













  • Since Users already exists, find that file and comment out everything in the Up function. This will allow the migration to continue without deleting the file.

    – aynber
    Jan 3 at 13:53



















  • Since Users already exists, find that file and comment out everything in the Up function. This will allow the migration to continue without deleting the file.

    – aynber
    Jan 3 at 13:53

















Since Users already exists, find that file and comment out everything in the Up function. This will allow the migration to continue without deleting the file.

– aynber
Jan 3 at 13:53





Since Users already exists, find that file and comment out everything in the Up function. This will allow the migration to continue without deleting the file.

– aynber
Jan 3 at 13:53












4 Answers
4






active

oldest

votes


















2
















If you check at the error trace, it says almost at the bottom:




Base table or view already exists: 1050 T able 'users' already
exists")
C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba
seConnection.php:458




This means that the users table already exists so when you run your migrations it is trying to create a table that is already created in your database, hence the error.



So tho undo this migrations before running them again, you could do:



php artisan migrate:refresh


Check the documentations regarding rolling back migrations.



This will run the down() function of every migration file already migrated in your system before actually running the up() ones.



If you go to your users migration, you can see the down() function, it should look like this:



database/migrations/XXXX_XX_XX_XXXXXX_create_users_table.php



/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}


Whenever you create a migration, always implement the down() method, to make use of the rolling back options.






share|improve this answer
























  • Migrate:refresh shows same error. When I try to roll back migration shows "Nothing to roll back". Down function is looking like that.

    – Mario Mlinarić
    Jan 3 at 14:09











  • If you go to your migrations table (the one that logs the migrations already run) it lists the migration of the users table? If not, you'll need to drop the users table manually (directly in your database)

    – HCK
    Jan 3 at 14:10













  • Migrations table is empty. Tried to drop users table, but nothing!

    – Mario Mlinarić
    Jan 3 at 14:48











  • If you already dropped the users table there shouldn't be any error (because there shouldn't be any conflict). Are you sure you are using the same dabatase connection that you are configuring?

    – HCK
    Jan 3 at 14:49



















0














Well, always that I install laravel i get the same error. Try changing code in your migration files like this:



public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email',64{ADD THIS PARAMETER})->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}


You have to add a second parameter to strings (max length) that are unique or keys, like email.
Don't forget to clear your DB of the tables so when you run php artisan migrate the DB is clear.






share|improve this answer
























  • Nope, shows the same error!

    – Mario Mlinarić
    Jan 3 at 18:54



















0














A migrate:refresh command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database:



php artisan migrate:refresh

// Refresh the database and run all database seeds...
php artisan migrate:refresh --seed




Another Solution is: Delete users table table from the database also delete users entries from migrations table.



After, execute run the migrate Artisan command: php artisan migrate






share|improve this answer

































    0














    i am sure this will work because i have the same issue but i fixed with this



     php artisan migrate:fresh


    please try and check



    UPDATE



    Delete project and install new laravel project



    and do chnages in your .env file and



    in database.php



     'mysql' => [
    'driver' => 'mysql',
    'host' => env('DB_HOST', '127.0.0.1'),
    'port' => env('DB_PORT', '3306'),
    'database' => env('DB_DATABASE', 'forge'),
    'username' => env('DB_USERNAME', 'forge'),
    'password' => env('DB_PASSWORD', ''),
    'unix_socket' => env('DB_SOCKET', ''),
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
    'strict' => true,
    'engine' => 'InnoDB',
    ],


    replace your existiing code to this



    and run



     php artisan make:auth 

    php artisan migrate


    or



      php artisan migrate:fresh


    i hope this time it will work



    and make sure you have all the requirements install in your system
    https://laravel.com/docs/5.7/installation






    share|improve this answer


























    • Nope, shows the same error!

      – Mario Mlinarić
      Jan 3 at 18:50











    • please check new update of my answer and follow

      – Boni
      Jan 4 at 6:02












    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023636%2ferror-while-migrating-database-laravel-table-already-exists%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    2
















    If you check at the error trace, it says almost at the bottom:




    Base table or view already exists: 1050 T able 'users' already
    exists")
    C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba
    seConnection.php:458




    This means that the users table already exists so when you run your migrations it is trying to create a table that is already created in your database, hence the error.



    So tho undo this migrations before running them again, you could do:



    php artisan migrate:refresh


    Check the documentations regarding rolling back migrations.



    This will run the down() function of every migration file already migrated in your system before actually running the up() ones.



    If you go to your users migration, you can see the down() function, it should look like this:



    database/migrations/XXXX_XX_XX_XXXXXX_create_users_table.php



    /**
    * Reverse the migrations.
    *
    * @return void
    */
    public function down()
    {
    Schema::dropIfExists('users');
    }


    Whenever you create a migration, always implement the down() method, to make use of the rolling back options.






    share|improve this answer
























    • Migrate:refresh shows same error. When I try to roll back migration shows "Nothing to roll back". Down function is looking like that.

      – Mario Mlinarić
      Jan 3 at 14:09











    • If you go to your migrations table (the one that logs the migrations already run) it lists the migration of the users table? If not, you'll need to drop the users table manually (directly in your database)

      – HCK
      Jan 3 at 14:10













    • Migrations table is empty. Tried to drop users table, but nothing!

      – Mario Mlinarić
      Jan 3 at 14:48











    • If you already dropped the users table there shouldn't be any error (because there shouldn't be any conflict). Are you sure you are using the same dabatase connection that you are configuring?

      – HCK
      Jan 3 at 14:49
















    2
















    If you check at the error trace, it says almost at the bottom:




    Base table or view already exists: 1050 T able 'users' already
    exists")
    C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba
    seConnection.php:458




    This means that the users table already exists so when you run your migrations it is trying to create a table that is already created in your database, hence the error.



    So tho undo this migrations before running them again, you could do:



    php artisan migrate:refresh


    Check the documentations regarding rolling back migrations.



    This will run the down() function of every migration file already migrated in your system before actually running the up() ones.



    If you go to your users migration, you can see the down() function, it should look like this:



    database/migrations/XXXX_XX_XX_XXXXXX_create_users_table.php



    /**
    * Reverse the migrations.
    *
    * @return void
    */
    public function down()
    {
    Schema::dropIfExists('users');
    }


    Whenever you create a migration, always implement the down() method, to make use of the rolling back options.






    share|improve this answer
























    • Migrate:refresh shows same error. When I try to roll back migration shows "Nothing to roll back". Down function is looking like that.

      – Mario Mlinarić
      Jan 3 at 14:09











    • If you go to your migrations table (the one that logs the migrations already run) it lists the migration of the users table? If not, you'll need to drop the users table manually (directly in your database)

      – HCK
      Jan 3 at 14:10













    • Migrations table is empty. Tried to drop users table, but nothing!

      – Mario Mlinarić
      Jan 3 at 14:48











    • If you already dropped the users table there shouldn't be any error (because there shouldn't be any conflict). Are you sure you are using the same dabatase connection that you are configuring?

      – HCK
      Jan 3 at 14:49














    2












    2








    2









    If you check at the error trace, it says almost at the bottom:




    Base table or view already exists: 1050 T able 'users' already
    exists")
    C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba
    seConnection.php:458




    This means that the users table already exists so when you run your migrations it is trying to create a table that is already created in your database, hence the error.



    So tho undo this migrations before running them again, you could do:



    php artisan migrate:refresh


    Check the documentations regarding rolling back migrations.



    This will run the down() function of every migration file already migrated in your system before actually running the up() ones.



    If you go to your users migration, you can see the down() function, it should look like this:



    database/migrations/XXXX_XX_XX_XXXXXX_create_users_table.php



    /**
    * Reverse the migrations.
    *
    * @return void
    */
    public function down()
    {
    Schema::dropIfExists('users');
    }


    Whenever you create a migration, always implement the down() method, to make use of the rolling back options.






    share|improve this answer















    If you check at the error trace, it says almost at the bottom:




    Base table or view already exists: 1050 T able 'users' already
    exists")
    C:xampphtdocsApplicationvendorlaravelframeworksrcIlluminateDataba
    seConnection.php:458




    This means that the users table already exists so when you run your migrations it is trying to create a table that is already created in your database, hence the error.



    So tho undo this migrations before running them again, you could do:



    php artisan migrate:refresh


    Check the documentations regarding rolling back migrations.



    This will run the down() function of every migration file already migrated in your system before actually running the up() ones.



    If you go to your users migration, you can see the down() function, it should look like this:



    database/migrations/XXXX_XX_XX_XXXXXX_create_users_table.php



    /**
    * Reverse the migrations.
    *
    * @return void
    */
    public function down()
    {
    Schema::dropIfExists('users');
    }


    Whenever you create a migration, always implement the down() method, to make use of the rolling back options.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 3 at 14:03









    HCKHCK

    3,81011338




    3,81011338













    • Migrate:refresh shows same error. When I try to roll back migration shows "Nothing to roll back". Down function is looking like that.

      – Mario Mlinarić
      Jan 3 at 14:09











    • If you go to your migrations table (the one that logs the migrations already run) it lists the migration of the users table? If not, you'll need to drop the users table manually (directly in your database)

      – HCK
      Jan 3 at 14:10













    • Migrations table is empty. Tried to drop users table, but nothing!

      – Mario Mlinarić
      Jan 3 at 14:48











    • If you already dropped the users table there shouldn't be any error (because there shouldn't be any conflict). Are you sure you are using the same dabatase connection that you are configuring?

      – HCK
      Jan 3 at 14:49



















    • Migrate:refresh shows same error. When I try to roll back migration shows "Nothing to roll back". Down function is looking like that.

      – Mario Mlinarić
      Jan 3 at 14:09











    • If you go to your migrations table (the one that logs the migrations already run) it lists the migration of the users table? If not, you'll need to drop the users table manually (directly in your database)

      – HCK
      Jan 3 at 14:10













    • Migrations table is empty. Tried to drop users table, but nothing!

      – Mario Mlinarić
      Jan 3 at 14:48











    • If you already dropped the users table there shouldn't be any error (because there shouldn't be any conflict). Are you sure you are using the same dabatase connection that you are configuring?

      – HCK
      Jan 3 at 14:49

















    Migrate:refresh shows same error. When I try to roll back migration shows "Nothing to roll back". Down function is looking like that.

    – Mario Mlinarić
    Jan 3 at 14:09





    Migrate:refresh shows same error. When I try to roll back migration shows "Nothing to roll back". Down function is looking like that.

    – Mario Mlinarić
    Jan 3 at 14:09













    If you go to your migrations table (the one that logs the migrations already run) it lists the migration of the users table? If not, you'll need to drop the users table manually (directly in your database)

    – HCK
    Jan 3 at 14:10







    If you go to your migrations table (the one that logs the migrations already run) it lists the migration of the users table? If not, you'll need to drop the users table manually (directly in your database)

    – HCK
    Jan 3 at 14:10















    Migrations table is empty. Tried to drop users table, but nothing!

    – Mario Mlinarić
    Jan 3 at 14:48





    Migrations table is empty. Tried to drop users table, but nothing!

    – Mario Mlinarić
    Jan 3 at 14:48













    If you already dropped the users table there shouldn't be any error (because there shouldn't be any conflict). Are you sure you are using the same dabatase connection that you are configuring?

    – HCK
    Jan 3 at 14:49





    If you already dropped the users table there shouldn't be any error (because there shouldn't be any conflict). Are you sure you are using the same dabatase connection that you are configuring?

    – HCK
    Jan 3 at 14:49













    0














    Well, always that I install laravel i get the same error. Try changing code in your migration files like this:



    public function up()
    {
    Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('email',64{ADD THIS PARAMETER})->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
    });
    }


    You have to add a second parameter to strings (max length) that are unique or keys, like email.
    Don't forget to clear your DB of the tables so when you run php artisan migrate the DB is clear.






    share|improve this answer
























    • Nope, shows the same error!

      – Mario Mlinarić
      Jan 3 at 18:54
















    0














    Well, always that I install laravel i get the same error. Try changing code in your migration files like this:



    public function up()
    {
    Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('email',64{ADD THIS PARAMETER})->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
    });
    }


    You have to add a second parameter to strings (max length) that are unique or keys, like email.
    Don't forget to clear your DB of the tables so when you run php artisan migrate the DB is clear.






    share|improve this answer
























    • Nope, shows the same error!

      – Mario Mlinarić
      Jan 3 at 18:54














    0












    0








    0







    Well, always that I install laravel i get the same error. Try changing code in your migration files like this:



    public function up()
    {
    Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('email',64{ADD THIS PARAMETER})->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
    });
    }


    You have to add a second parameter to strings (max length) that are unique or keys, like email.
    Don't forget to clear your DB of the tables so when you run php artisan migrate the DB is clear.






    share|improve this answer













    Well, always that I install laravel i get the same error. Try changing code in your migration files like this:



    public function up()
    {
    Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name');
    $table->string('email',64{ADD THIS PARAMETER})->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
    });
    }


    You have to add a second parameter to strings (max length) that are unique or keys, like email.
    Don't forget to clear your DB of the tables so when you run php artisan migrate the DB is clear.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 3 at 15:40









    nyu.exenyu.exe

    1278




    1278













    • Nope, shows the same error!

      – Mario Mlinarić
      Jan 3 at 18:54



















    • Nope, shows the same error!

      – Mario Mlinarić
      Jan 3 at 18:54

















    Nope, shows the same error!

    – Mario Mlinarić
    Jan 3 at 18:54





    Nope, shows the same error!

    – Mario Mlinarić
    Jan 3 at 18:54











    0














    A migrate:refresh command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database:



    php artisan migrate:refresh

    // Refresh the database and run all database seeds...
    php artisan migrate:refresh --seed




    Another Solution is: Delete users table table from the database also delete users entries from migrations table.



    After, execute run the migrate Artisan command: php artisan migrate






    share|improve this answer






























      0














      A migrate:refresh command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database:



      php artisan migrate:refresh

      // Refresh the database and run all database seeds...
      php artisan migrate:refresh --seed




      Another Solution is: Delete users table table from the database also delete users entries from migrations table.



      After, execute run the migrate Artisan command: php artisan migrate






      share|improve this answer




























        0












        0








        0







        A migrate:refresh command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database:



        php artisan migrate:refresh

        // Refresh the database and run all database seeds...
        php artisan migrate:refresh --seed




        Another Solution is: Delete users table table from the database also delete users entries from migrations table.



        After, execute run the migrate Artisan command: php artisan migrate






        share|improve this answer















        A migrate:refresh command will roll back all of your migrations and then execute the migrate command. This command effectively re-creates your entire database:



        php artisan migrate:refresh

        // Refresh the database and run all database seeds...
        php artisan migrate:refresh --seed




        Another Solution is: Delete users table table from the database also delete users entries from migrations table.



        After, execute run the migrate Artisan command: php artisan migrate







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Jan 3 at 16:03

























        answered Jan 3 at 15:57









        Udhav SarvaiyaUdhav Sarvaiya

        2,57792131




        2,57792131























            0














            i am sure this will work because i have the same issue but i fixed with this



             php artisan migrate:fresh


            please try and check



            UPDATE



            Delete project and install new laravel project



            and do chnages in your .env file and



            in database.php



             'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => 'InnoDB',
            ],


            replace your existiing code to this



            and run



             php artisan make:auth 

            php artisan migrate


            or



              php artisan migrate:fresh


            i hope this time it will work



            and make sure you have all the requirements install in your system
            https://laravel.com/docs/5.7/installation






            share|improve this answer


























            • Nope, shows the same error!

              – Mario Mlinarić
              Jan 3 at 18:50











            • please check new update of my answer and follow

              – Boni
              Jan 4 at 6:02
















            0














            i am sure this will work because i have the same issue but i fixed with this



             php artisan migrate:fresh


            please try and check



            UPDATE



            Delete project and install new laravel project



            and do chnages in your .env file and



            in database.php



             'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => 'InnoDB',
            ],


            replace your existiing code to this



            and run



             php artisan make:auth 

            php artisan migrate


            or



              php artisan migrate:fresh


            i hope this time it will work



            and make sure you have all the requirements install in your system
            https://laravel.com/docs/5.7/installation






            share|improve this answer


























            • Nope, shows the same error!

              – Mario Mlinarić
              Jan 3 at 18:50











            • please check new update of my answer and follow

              – Boni
              Jan 4 at 6:02














            0












            0








            0







            i am sure this will work because i have the same issue but i fixed with this



             php artisan migrate:fresh


            please try and check



            UPDATE



            Delete project and install new laravel project



            and do chnages in your .env file and



            in database.php



             'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => 'InnoDB',
            ],


            replace your existiing code to this



            and run



             php artisan make:auth 

            php artisan migrate


            or



              php artisan migrate:fresh


            i hope this time it will work



            and make sure you have all the requirements install in your system
            https://laravel.com/docs/5.7/installation






            share|improve this answer















            i am sure this will work because i have the same issue but i fixed with this



             php artisan migrate:fresh


            please try and check



            UPDATE



            Delete project and install new laravel project



            and do chnages in your .env file and



            in database.php



             'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => 'InnoDB',
            ],


            replace your existiing code to this



            and run



             php artisan make:auth 

            php artisan migrate


            or



              php artisan migrate:fresh


            i hope this time it will work



            and make sure you have all the requirements install in your system
            https://laravel.com/docs/5.7/installation







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Jan 4 at 6:01

























            answered Jan 3 at 17:34









            BoniBoni

            338




            338













            • Nope, shows the same error!

              – Mario Mlinarić
              Jan 3 at 18:50











            • please check new update of my answer and follow

              – Boni
              Jan 4 at 6:02



















            • Nope, shows the same error!

              – Mario Mlinarić
              Jan 3 at 18:50











            • please check new update of my answer and follow

              – Boni
              Jan 4 at 6:02

















            Nope, shows the same error!

            – Mario Mlinarić
            Jan 3 at 18:50





            Nope, shows the same error!

            – Mario Mlinarić
            Jan 3 at 18:50













            please check new update of my answer and follow

            – Boni
            Jan 4 at 6:02





            please check new update of my answer and follow

            – Boni
            Jan 4 at 6:02


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54023636%2ferror-while-migrating-database-laravel-table-already-exists%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            'app-layout' is not a known element: how to share Component with different Modules

            android studio warns about leanback feature tag usage required on manifest while using Unity exported app?

            WPF add header to Image with URL pettitions [duplicate]