1

I had issues with my xampp phpmyadmin, I had to uninstall and reinstall it, after that , I tried copying my files back and running my application but it's not working.

Its giving me

SQLSTATE[42S02]: Base table or view not found: 1932 Table 'blog.categories' doesn't exist in engine (SQL: select * from `categories`)

I have tried migration of my files to the database but it's also not working

Here's what it says:

  [Illuminate\Database\QueryException]
  SQLSTATE[42S02]: Base table or view not found: 1932 Table 'blog.migrations' doesn't exist in engine (SQL: select `m
  igration` from `migrations` order by `batch` asc, `migration` asc)



  [PDOException]
  SQLSTATE[42S02]: Base table or view not found: 1932 Table 'blog.migrations' doesn't exist in engine
Marc Delisle
  • 8,879
  • 3
  • 29
  • 29
  • what is your DB name in your `.env` file and in `phpadmin` ? – Sandeep Sudhakaran Oct 23 '19 at 12:47
  • Possible duplicate https://stackoverflow.com/questions/30159257/base-table-or-view-not-found-1146-table-laravel-5 – Eyad Jaabo Oct 23 '19 at 12:51
  • my db name is blog and in phpmyadmin its also blog –  Oct 23 '19 at 15:17
  • someone pleas help i cant start all over again –  Oct 24 '19 at 13:22
  • Have you tried `php artisan migrate:fresh`? This will run all migrations all over again, so only use it if there is no valuable information in there – Tim Oct 24 '19 at 14:58
  • yes i fixed it with php artisan config:cache –  Oct 24 '19 at 15:16
  • so the solution was just to clear my cache and migrate again so i ran php artisan config:cache after it was cleared then i ran php artisan migrate, which fixed it and got all mt table back to my database . –  Oct 24 '19 at 15:19

3 Answers3

5

Disconnect all server connections. Including commands:

php artisan serve

And stop the Apache server and MySQL database and start again. then run:

php artisan migrate
Negar Javadzadeh
  • 325
  • 7
  • 11
1

If you try running this before

php artisan schema:dump

which may conflicted with database migration because it squashing migrations to be executed as sql before any migrations in database/migration, try deleting any file in database/schema then try run

php artisan migrate

if the migrate command didn't simply work, try the Negar answer to help the migration

0

That means that the DB lost or the base of that database doesn't exist. you must have a backup where you will have to drop and import that same db back then restart to what you wanted to do

or

drop the Database, create the same name and use command:

php artisan migrate

to return it but all previous data will have been lost and you have to add it manually or via the application again