How are you running your database? Also it seems your config might be cached
php artisan config:clear
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
In terminal, when I try to migrate using php artisan migrate, I get this sql error:
Illuminate\Database\QueryException
SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from information_schema.tables where table_schema = myproject and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
674▕ // If an exception occurs when attempting to run a query, we'll format the error
675▕ // message to include the bindings with SQL, which will make this exception a
676▕ // lot more helpful to the developer instead of just the database's errors.
677▕ catch (Exception $e) {
➜ 678▕ throw new QueryException(
679▕ $query, $this->prepareBindings($bindings), $e
680▕ );
681▕ }
682▕
+33 vendor frames
34 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
I believe that I've setup my .env file correctly
APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:6UahK+RBOJO1i6+36UkcUNK3zdcQOnIXlEJv/HpKL9w=
APP_DEBUG=true
APP_URL=http://myproject.test
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myproject
DB_USERNAME=root
DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
I've tried most of the solutions online including creating a new user with a set password and giving them the same privileges as root but still stuck here. Anyone who has had this issue, how do I fix?
Ok. Do you still have the user you created? Try with that again, and post the new error if one comes
Please or to participate in this conversation.