Search code examples
phpmysqllaravellaravel-5.4laravel-artisan

Laravel 5.4 - I can't even execute php artisan config:clear - [Illuminate\Database\QueryException] SQLSTATE[HY000] [1044]


My project was working fine. After copy and pasting files in another Mac localhost, I always get the same error:

[Illuminate\Database\QueryException]
SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database '***' (SQL: select * from roles)

[PDOException]

SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database '***'

I already checked the .env file, but it seems Laravel can't execute code at this point. This 'roles' is a table with many to many relations trough pivot table.

Note 1: Fresh Laravel aplications works fine.

Note 2: Because I can't clear the cache, Laravel always considers the user to b be blank.

Can someone help me, please?

Thank you!


Solution

  • I replaced files off a fresh application with my files(models, controllers, middlewares, migrations ...) and everything worked fine.

    The solution:

    https://laracasts.com/discuss/channels/general-discussion/base-table-or-view-not-found-1146-table-doesnt-exist/replies/151761