check your credentials for accuracy
did you really name your database DB_DATABASE=lavarelsample ?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
php artisan migrate
file .env DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=8889 DB_DATABASE=lavarelsample DB_USERNAME=root DB_PASSWORD=root
Mamp pro 6.6 setting Apache: 8888 Nginx: 7888 mySQL: 8889 Memcached:11211 Redis: 6379
when run "PHP artisan migrate" and then i got this bug
" Illuminate\Database\QueryException
SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select table_name as name, (data_length + index_length) as size, table_comment as comment, engine as engine, table_collation as collation from information_schema.tables where table_schema = 'lavarelsample' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829 825▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 826▕ ); 827▕ } 828▕ ➜ 829▕ throw new QueryException( 830▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 831▕ ); 832▕ } 833▕ } +36 vendor frames 37 artisan:37"
my phpadmin User accounts
User name Host name Password Global privileges Grant | kien1 localhost Yes ALL PRIVILEGES Yes | root 127.0.0.1 No ALL PRIVILEGES Yes | root ::1 Yes ALL PRIVILEGES Yes | root localhost Yes ALL PRIVILEGES Yes |
my .env file: DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=8889 DB_DATABASE=lavarelsample DB_USERNAME=kien1 DB_PASSWORD='Kienlocalhost' <-- this is right password
when run "PHP artisan migrate" and then i also got same bug: "SQLSTATE[HY000] [2002] No such file or director"
i haven't download MySQL ------> solution here: stackoverflow.com/questions/77367823/why-does-php-artisan-migrate-command-resulted-in-sqlstatehy000-2002-conne#:~:text=Update%3A,Troubleshooting%20process%3A
I do download 8.0.37 -arm64 for my mac, after i start MySQL Server, i try my DB_User as root & kien1
i got this bug:
" Illuminate\Database\QueryException
SQLSTATE[HY000] [1045] Access denied for user 'kien1'@'localhost' (using password: YES) (Connection: mysql, SQL: select table_name as name, (data_length + index_length) as size, table_comment as comment, engine as engine, table_collation as collation from information_schema.tables where table_schema = 'lavarelsample' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)"
can anyone have me find this solution, I've been stuck on this error for 4 days
Please or to participate in this conversation.