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

mstdmstd's avatar

I got error running migration under priject I added into homestead?

I added new project with migration files into homestead and I added new database name :

databases:
   ...
    - ProjectName

ports:
    - send: 33060 # MySQL/MariaDB
    to: 3306

In .env I added all connect parameters:

After I entered vagrant bash I got error running migration:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=ProjectName
DB_USERNAME=root
DB_PASSWORD=root
$ php artisan migrate

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002]  (SQL: select * from information_schema.tables where table_schema = ProjectName and table_name = migrations and table_type = 'BASE TABLE')

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
    708▕         // If an exception occurs when attempting to run a query, we'll format the error
    709▕         // message to include the bindings with SQL, which will make this exception a
    710▕         // lot more helpful to the developer instead of just the database's errors.
    711▕         catch (Exception $e) {
  ➜ 712▕             throw new QueryException(
    713▕                 $query, $this->prepareBindings($bindings), $e
    714▕             );
    715▕         }
    716▕     }

      +33 vendor frames 
  34  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

I have a ProjectName database in my homestaead phpmyadmin. I copypasted migrations table from other project, but I still got this error... How to fix it ? I cleared cahch with command :

php artisan config:cache

Seems I have valid ports set. How can I check it additively ?

Thank you!

0 likes
2 replies
LaryAI's avatar
Level 58

It looks like the issue is related to the database connection. Make sure that the database name, username, and password in your .env file are correct. Additionally, you can try running the following command to check the connection:

php artisan migrate:status

If the connection is successful, you should see a list of all the migrations that have been run. If the connection is unsuccessful, you should see an error message that will help you identify the issue.

1 like
mstdmstd's avatar
mstdmstd
OP
Best Answer
Level 8

I set invalid passport. Must be :

  DB_PASSWORD=secret

Please or to participate in this conversation.