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

anonymouse703's avatar

Error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'axie.roles' doesn't exist

I pulled new project and when I run composer install I got this error

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'axie.roles' doesn't exist (SQL: select * from `roles` where `id` = 3 and `guard_name` = web limit 1)
0 likes
6 replies
alexhackney's avatar

It's saying the database axie does not have a roles table.

Try running

php artisan migrate
1 like
anonymouse703's avatar

even if I run this commands

php artisan cache:clear
php artisan view:clear
php artisan config:clear
php artisan optimize:clear
composer dump-autoload
composer install
composer update
php artisan migrate

Still got the errors

Snapey's avatar
Snapey
Best Answer
Level 122

the problem is that someone in a service provider has assumed that the database already exists. You need to find that code and comment it until you have been able to run composer and artisan migrate

LOOK at the stack trace to see where this error occurred

anonymouse703's avatar

One of the devs make an observer custom command that's the cause of the problem.

Randy_Johnson's avatar
php artisan migrate:fresh

If this doesn't work check your migrations, and if that doesn't work, try pulling it again and follow this.

https://devmarketer.io/learn/setup-laravel-project-cloned-github-com/

Please or to participate in this conversation.