Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

KodiakSA's avatar

No migrations table

I am new to laravel and have a new 5.2 laravel installation. I would like to use migrations. Database connection to MySQL setup correctly in .env file.

If I run php artisan migrate I get the message that the migrations table does not exist I get the same message for: php artisan migration:install

What do I do to create the migrations table correctly?

0 likes
12 replies
XenitXTD's avatar

Hi, The Migrations Table is created automatically, So if its looking for a migration table it expects it to be there due to something

Maybe try the following commands

php artisan migrate:rollback

or a complete reset using

php artisan migrate:reset

or

php artisan migrate:refresh

the Link for migrations documentation can be found here

https://laravel.com/docs/5.2/migrations#rolling-back-migrations

KodiakSA's avatar

Nope, none of the documentation or any of those commands work. No matter what I do I get this error message [Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'My_Database.migrations' doesn't exist (SQL: select * from migrations) [PDOException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'redpl154_demo.migrations' doesn't exist

So, how do I force it to create the migrations table? It's a MySQL server. Setup in .env and the user that is logging in as full permissions on the database

freel's avatar

Try to restart server. If this will not help you. Show us migration file. Tell me do you have any tables in the DB and so on.

KodiakSA's avatar

OK, I restarted the server (Centos 6.7) -- PHP 5.6 -- Laravel 5.2 I get exactly the same error message, basically migrations table not found, so it is not been created for some reason

It is a newly created database and there are no tables in it at all

XenitXTD's avatar

Hi,

what is the Output if you run

php artisan migrate:status

Also Just run a composer update on your laravel project to get the latest 5.2 laravel update so just incase the is a bug which is unlikely but just to be sure update it

KodiakSA's avatar

Exactly the same as my error messages above. Basically, migrations table does not exist...

KodiakSA's avatar

OK, looks to have been solved, I deleted by laravel installation (it was new and originally installed with composer). I then installed with the laravel command. I had to install the Zip extension to get this to work. Now, the php artisan migrate function worked creating the migrations, reset_password and users table automatically. Not sure why all that went down, but that's what happened

Elvo's avatar

@KodiakSA Hello! How did you manage to do this? I am having problems with migrations Thanks.

senaranya's avatar

In case if someone's reading this in future, php artisan migrate:installhelps create migrations table.

2 likes
gthomas3's avatar

Also for posterity, if you're running Laravel on a VM and not just the dev server, the php artisan migrate command needs to be run from within the VM. On vagrant you need to: vagrant ssh -> cd /vagrant -> php artisan migrate. I had the same error being reported when trying to run the migrate command from my local machine.

1 like
phillir's avatar

senaranya, The future says thank you.

Please or to participate in this conversation.