简体   繁体   中英

LARAVEL SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it

Firstly I used

php artisan make:auth

Then I change my .env variables like this

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3310
DB_DATABASE=leaflet
DB_USERNAME=root
DB_PASSWORD=alpha

the i used php artisan migrate It gave me response migration created successfully Now when I am registering it gives me an error

SQLSTATE[HY000] [2002] No connection could be made because the target machine actively refused it. 

Can anyone tell me why?,I checked my database and the tables are created successfully and my mysql server is also running I checked on mysql workbench

i installed admin for laravel ( install laravel-admin and also voyager on another instance)

i try to connect my laravel 5.8 into mysql on xampp.

both cant connect as well (my laravel create tables with php artisan migrate but cant connect)

after that i installed mysql 8 on my system on port 3307

and its worked great with laravel.

if you want please install mysql workbench (instead of phpmyadmin)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM