SQLSTATE[08006] timeout expired

12,493

The problem is, it's not connecting to your database.

I solved that problem by changing the port from 50861 to 5432, which was the default port I gave to PostgreSQL.

Share:
12,493

Related videos on Youtube

Arthur Oliveira
Author by

Arthur Oliveira

Updated on June 04, 2022

Comments

  • Arthur Oliveira
    Arthur Oliveira almost 2 years

    I'm trying to connect a laravel project to postgresql database using Vagrand with homestead and VirtualBox, but I always getting this error below when migrate, i've tried changing host and port, but still the same. Can somebody give me a clue to solve this? I look in a lot of questions with the same error, but none of them helped to, sorry if is something simple or already has a question that shoult solve!

    Thanks so much!

    Illuminate\Database\QueryException  : SQLSTATE[08006] [7] timeout expired (SQL: select * from information_schema.tables where table_schema = public and table_name = migrations)
    
     at /home/arthur/ERPet/erpet/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
      660|         // If an exception occurs when attempting to run a query, we'll format the error
      661|         // message to include the bindings with SQL, which will make this exception a
      662|         // lot more helpful to the developer instead of just the database's errors.
      663|         catch (Exception $e) {
    > 664|             throw new QueryException(
      665|                 $query, $this->prepareBindings($bindings), $e
      666|             );
      667|         }
      668|
    
    Exception trace:
    
    1   PDOException::("SQLSTATE[08006] [7] timeout expired")
      /home/arthur/ERPet/erpet/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
    
    2   PDO::__construct("pgsql:host=192.168.10.10;dbname=erpet;port=5432;sslmode=prefer", "homestead", "secret", [])
      /home/arthur/ERPet/erpet/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
    
    Please use the argument -v to see more details.
    
    • apokryfos
      apokryfos about 5 years
      that host 192.168.10.10 is a LAN host. If you keep the default configuration most databases will bind to 127.0.0.1 (localhost) so will not accept connections outside of the localhost. Check your configuration and make sure your bind address is changed to the LAN IP (e.g. 192.168.10.10) or 0.0.0.0 to allow connections from everywhere