Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

323
Visualizações
php artisan migrate = connection refused (mac/laravel/xampp)

so I'm getting this error when trying to run php artisan migrate on my newly created laravel project:

    Illuminate\Database\QueryException 

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

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
    667|         // If an exception occurs when attempting to run a query, we'll format the error
    668|         // message to include the bindings with SQL, which will make this exception a
    669|         // lot more helpful to the developer instead of just the database's errors.
    670|         catch (Exception $e) {
  > 671|             throw new QueryException(
    672|                 $query, $this->prepareBindings($bindings), $e
    673|             );
    674|         }
    675| 

I have googled extensively and while finding similar errors and trying to change things, I could not resolve my issue.. some information that might help and the things I have tried so far:

  • I'm on a mac
  • I'm using Xampp
  • I had made sure I had started MySQL on Xampp before running the command
  • I had changed my DB_HOST from 127.0.0.1 to localhost on my .env file, cleared cache and tried again, it didn't work (it did give me an error of no such file or directory though) I had also changed that on the database.php
  • I had created the database "laravel-social" on phpMyAdmin
  • I had confirmed the port, database username and password (it is root with no password, I had tried using one though, but the error was the same, so I returned back for the sake of debugging)
  • This is a newly created project, so I'm not migrating a project from Windows or somewhere else
  • Funny thing is that with or without Xampp started, I get this same error. Maybe something there?

.env file:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel-social
DB_USERNAME=root
DB_PASSWORD=

Thanks everyone!

over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda