chandachewe10/loan-management-system

Cannot migrate DB

Closed this issue · 0 comments

Hello, I have an issue with the "php artisan migrate" command.

  • OS: Debian 12 fresh install
  • php8.2
  • also tested with php8.1, same behaviour

The error is :

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'laravel' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
    828▕ 
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

      +39 vendor frames 

  40  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

I have tried changing the value of DB_HOST from 127.0.0.1 to localhost but then I have another error which is :


   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'laravel' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

  at vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
    828▕ 
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

      +39 vendor frames 

  40  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

Could you enlighten me please ?

By the way, in the .env file, I only changed the DB_PASSWORD value.