framework: [5.8.13] 'SQLSTATE[HY000] [2002] Connection refused' if docktrine/dbal installed
- 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:
- Create new project:
composer create-project --prefer-dist laravel/laravel blog
- Fix
1071 Specified key was too longerror: 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);
}
- Try to install
doctrine/dbalpackage:
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
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 2
- Comments: 20 (10 by maintainers)
Commits related to this issue
- Using Laravel 5.8.12 Reason: https://github.com/laravel/framework/issues/28282 — committed to et-nik/gameap by et-nik 5 years ago
@driesvints this also breaks the
package:discovercommand that runs aftercomposer install. I noticed this because our build process started failing as there is no.envand no database available yet at thecomposer installstep in our build process.After applying your revert from https://github.com/laravel/framework/pull/28301 it started working again.
Hopefully this can be tagged soon and properly addressed later. 😃