Skip to content

[5.8.13] 'SQLSTATE[HY000] [2002] Connection refused' if docktrine/dbal installed #28282

@et-nik

Description

@et-nik
  • Laravel Version: 5.8.13
  • PHP Version: 7.2.15
  • Database Driver & Version: none

Description:

You can't run composer update and call artisan commands if add Schema::defaultStringLength calling to AppServiceProvider and you have doctrine/dbal package.

On running composer require doctrine/dbal:

In PDOConnection.php line 31:
                                             
  SQLSTATE[HY000] [2002] Connection refused  
                                             

In PDOConnection.php line 27:
                                             
  SQLSTATE[HY000] [2002] Connection refused 

On 5.8.12 works fine.

Steps To Reproduce:

  1. Create new project:
composer create-project --prefer-dist laravel/laravel blog
  1. Fix 1071 Specified key was too long error:
    Using official documentation: https://laravel.com/docs/5.8/migrations#indexes

Add Schema::defaultStringLength calling to AppServiceProvider

use Illuminate\Support\Facades\Schema;

/**
 * Bootstrap any application services.
 *
 * @return void
 */
public function boot()
{
    Schema::defaultStringLength(191);
}
  1. Try to install doctrine/dbal package:
composer require doctrine/dbal

You will get error:

In PDOConnection.php line 31:
                                             
  SQLSTATE[HY000] [2002] Connection refused  
                                             

In PDOConnection.php line 27:
                                             
  SQLSTATE[HY000] [2002] Connection refused  
                                             

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions