0

I was creating an application on Laravel. At some point of time, I had to reinstall my WAMP server. Now I installed it again and created the same database. When I tried to migrate everything again using the command php artisan migrate, I got the following errors.

[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 La table 'learning.migrations' n'exists pas (SQL: create table 'migrations' ('migration' varchar(255) not null, 'batch' int null) default character set utf8 collate utf8_unicode_ci)

and

[PDOException]
SQLSTATE[42S02]: Base table or view not found:1146 La table 'learning.migrations' n'existe pas

and

migrate [--bench[="..."]] [--database[="..."]] [--force] [--path["..."]] [--package[="..."]] [--pretend] [--seed]

What might be the problem? How can I solve this?

user1012181
  • 8,648
  • 10
  • 64
  • 106
  • Try these two commands, to see if `artisan` and `composer` work first, `$ php artisan env` and `$ composer dumpautoload` – Pete Houston Nov 19 '14 at 17:03
  • `Current application environment: production` Second one: 'Warning: Ambiguous class resolution, "TablePrograms" was found in both -------' – user1012181 Nov 19 '14 at 17:37
  • (-----) means It's comparing two migration files. I don't wanna type that big section. – user1012181 Nov 19 '14 at 17:45
  • The problem is that the table `migrations` in database `learning` is not created, and the cause is related either to database config or migrations. You can check if database `learning` exists, the database config for `production` is `learning`. – Pete Houston Nov 19 '14 at 17:50
  • The Database is existing. How can I check the Database config for the Production? – user1012181 Nov 19 '14 at 17:51
  • Look up: `app/config/database.php`, key `mysql => array()` – Pete Houston Nov 19 '14 at 17:52
  • `'mysql' => array( 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'learning', 'username' => 'root', 'password' => '', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', ),` – user1012181 Nov 19 '14 at 17:56
  • is database `learning` empty? I mean by the state of database after creating through this, `CREATE DATABASE learning;` – Pete Houston Nov 19 '14 at 17:58
  • Yeah, the database is empty. No table at all. I created it directly from phpmyadmin panel. – user1012181 Nov 19 '14 at 18:08

2 Answers2

1

You can try this:

In your phpMyAdmin: create the database.

In your command console:

1) In your proyect folder execute: php artisan migrate:install
This will create the table "migrations" in your database

2) Then execute: php artisan migrate

Turcko007
  • 21
  • 3
0

The problem was from the wamp reinstall. When I reinstalled the wamp server, in the MySQL folder, there was an old file with the database name and everything (this was because I had not deleted the DB before reinstalling WAMP). So all you gotta do is go to your MySQL installation folder, in my case: C:\wamp\bin\mysql\mysql5.6.17\data and delete the folder with the old db name. This should solve your problem.

iamcastelli
  • 1,564
  • 2
  • 20
  • 30
user1012181
  • 8,648
  • 10
  • 64
  • 106