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

marcelo2605's avatar

MySQL connect on Laravel 5.2

I'm using Laravel with a Vagrant box called Scotchbox and can't run artisan migrate. The following error appear:

[PDOException] SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)

Here is a partial of my .env file:

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=scotchbox
DB_USERNAME=root
DB_PASSWORD=root

Running mysqladmin -u root -p status on SSH return this:

Uptime: 1308 Threads: 3 Questions: 131 Slow queries: 0 Opens: 48 Flush tables: 1 Open tables: 41 Queries per second avg: 0.100

If I change DB_PASSWORD to '', the system cannot find the table:

[PDOException] SQLSTATE[HY000] [1049] Unknown database 'scotchbox'

I confirm the connection values using MySQL Workbench.

0 likes
1 reply
marcelo2605's avatar

Found the solution: I need to run artisan migrate in Vagrant SSH.

1 like

Please or to participate in this conversation.