SQLSTATE[HY000] [2002] Connection refused after update XAMPP with PHP 7.2 on mac - laravel

Everything worked fine until I update XAMPP with PHP from 7.1 to 7.2. I noticed to access phpmyadmin using this new XAMPP on mac, need port 8080 (http://localhost:8080/phpmyadmin). Is this the problem? I already tried to change DB_HOST from 127.0.0.1 to localhost but nothing works.
Here my .env looks like
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=testing
DB_USERNAME=root
DB_PASSWORD=''

Related

SQLSTATE[HY000] [2002] Connection refused |

I'm using MAC OS and I'm new to laravel .. I'm working on laravel using xampp and when i run the command php artisan migrate
I get this error
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = web and table_name = migrations and table_type = 'BASE TABLE')
my .env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=web
DB_USERNAME=root
DB_PASSWORD=
I searched and tried most of the ways and it is still not working unfortunately
Try the methods below:
open your .env file and change DB_HOST = 127.0.0.1 to localhost
try restarting your localhost server (xampp)
try downgrading your xampp to a lower version

Laravel Homestead could not connect to server 127.0.0.1

I have installed laravel homestead and vagrant. After vagrant up my local site started work.
My migrations worked well and i could connect to DB with PhpStorm ( http://joxi.ru/a2X45M1S1x3Vw2 )
my .env file contains the same code as written in doc
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=54320
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
But when I try to register new user I got an error
SQLSTATE[08006] [7] could not connect to server: Connection refused Is
the server running on host "127.0.0.1" and accepting TCP/IP
connections on port 54320?
( http://joxi.ru/nAynW7asYOD39r )
How it possible when migrations run well but connection refused?
Your screenshot says that Laravel is having trouble connecting to 192.168.10.10, which isn't the same as 127.0.0.1. Check that the correct DB_HOST is set in your .env file.
In case the config from the .env file isn't being used, also check the config/database.php file and verify the settings there too.
You have to change .env -> DB_PORT
for pgsql use DB_PORT=5432
I was having this same issue, and what worked for me was to change my DB_HOST=127.0.0.1 to ip: "192.168.56.56"(the same id that is on my Homestead.yaml file).

Laravel Homestead not working database connect

I have installed laravel homestead and run it.
But I can't run migration locally and in vagrant.
If I try to run the migration inside vagrant
cd ~/code/project/
php artisan migrate
I got an error
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 54320?"
If I try to run the migration locally I got a another error
PDOException::("could not find driver")
my .env file contains the same code as written in doc
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=54320
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Maybe something I do not understand but do I need posgresql locally and inside my vagrant? Where I have to work with database locally or with vagrant?

DB_HOST and Browser Settings For Laravel App

I'm putting together a Laravel 5.2 application and using Homestead with it. When I need to migrate my database these are the settings that I have set up that allows me to do migrate. However if I want to use these in my browswer then I have to switch 127.0.0.1 to localhost. Why do I have to do this and how do I fix that?
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Anybody have any ideas on this?
if you are using wamp do like this:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=33060
DB_DATABASE=mysql
DB_USERNAME=root
DB_PASSWORD=
mysql is your database .you can access it by going localhost/phpmyadmin
I was able to find out that I need to keep it as DB_PORT=3306 and only use 33060 for when I'm trying to access the database with a program like Sequel Pro.

Laravel not connecting to homestead database

I was developing a laravel application locally on Mac connecting to a mysql database. i recently found out about homestead and pulled my app over to Vagrant Homestead. however now im not able to connect to the mysql server on the homestead/box.
Error i recieve:
SQLSTATE[HY000] [1045] Access denied for user 'root'#'localhost' (using password: YES)
I did update my app's .env file
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=eHDatabase
DB_USERNAME=homestead
DB_PASSWORD=secret
I cleared my app's cache
php artisan cache:clear
I updated my /etc/hosts file
27.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 laravel.app
and i also removed the old mysql server running on port 3306 on 127.0.0.1.
but still recieve the connection error.
Any help would be great.
Both .env and /config/database.php are looking fine, so try to run this:
php artisan config:cache

Resources