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

JnTng's avatar
Level 2

Homestead Database\QueryException

I use Homestead and my .env setting is base on Laravel document suggestion

(To connect to your MySQL or Postgres database from your main machine via Navicat or Sequel Pro, you should connect to 127.0.0.1 and port 33060 (MySQL) or 54320 (Postgres). The username and password for both databases is homestead / secret.)

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=laravel-shopping
DB_USERNAME=homestead
DB_PASSWORD=secret

However I got this error when I run migrate:install

   Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] No such file or directory (SQL: create table `migrations` (`id` int unsigned not null auto_increment primary key, `migration` varchar(191) not null, `batch` int not null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')

I've spent hours on it, help me plz.

0 likes
7 replies
automica's avatar

@jntng homesteads default db port is 3306.

if you are running artisan migrate command you need to do it by first ssh'ing onto the vagrant box and then running the command from the application root.

JnTng's avatar
Level 2

@automica thanks for ur suggestion

I fix my port to 3306 and run config:cache and I've used vagrant ssh then run migrate

however I got same error message

JnTng's avatar
JnTng
OP
Best Answer
Level 2

the problem is solved the reason is that the project I cloned use 'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock'

and I didnt install MAMP

Thanks @automica helping me.

Please or to participate in this conversation.