0

when I tried php artisan migrate an error :

{"error":{"type":"Illuminate\\Database\\QueryException","message":"SQLSTATE[42S02]: Base table or view not found: 1051 Unknown table 'laravel.users' (SQL: drop table `users`)","file":"\/opt\/lampp\/htdocs\/laravel\/coba1\/latihan3\/vendor\/laravel\/framework\/src\/Illuminate\/Database\/Connection.php","line":625}}

I use the mysql database, please give solution

2
  • Please provide some source from your users migration in database/migrations and also what is the name of your database in .env? Commented Jun 19, 2016 at 3:07
  • Your error message suggests you are trying to rollback a migration, are you running php artisan migrate:refresh by any chance? As per the error it is trying to drop a table that doesn't exist. Commented Jun 19, 2016 at 3:22

2 Answers 2

1

You are attempting to drop a table that does not exist. You are either not using the correct database (laravel) or you are doing this as part of a rollback or modification.

Remember that your migrations should include a function that makes changes (up) and a function that undoes those changes (down). Database: Migrations

public function up()
{
    Schema::create('users', function (Blueprint $table) {
        // columns
    });
}

public function down()
{
    Schema::drop('users');
}

If you are dropping a table that you are not sure exists you can

Schema::dropIfExists('users');
Sign up to request clarification or add additional context in comments.

Comments

0

Check database name (it should be 'laravel' named or change yor config file to right database name) and check existing table users in your database.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.