SQLSTATE[HY000] [2002] No such file or directory in Magento - magento

If I try to setup my DB in MAGENTO I get this error:
This is my docker-compose YAML file:
I have already reinstalled it a couple of times and I changed my localhost from localhost to 127.0.0.1 already.
Can someone help me solve this problem?

Related

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

Laravel Homestead error with nginx

Found the error " 502 Bad Gateway
nginx/1.9.9 "
While checking server in laravel Homestead using the address: http://phpmyadmin.app:8000/
Whats the problem and how to solve it?
If your ip is not set to 192.168.10.10 then its possible you get the error also you might need to edit your homestead.yaml site configuration to phpmyadmin.ap and not phpmyadmin.app also refrain yourself from using phpmyadmin.test, phpmyadmin.dev and so on I do not know if its a bug homestead are yet to fix.
Hope this solve the issue.

Configuring Homestead to work with MySQL Workbench

I just started using Homestead today and so far I don't think I know what I am doing, previously I was using the inbuilt PHP server that comes with Laravel and I had MySQL server and workbench installed separately on my computer.
With this setup I was able to connect to my database with ease, however since I got my Homestead running I can't seem to access that database again. This error keeps popping up:
3/3 ErrorException in Connector.php line 47: SQLSTATE[HY000] [1045]
Access denied for user 'myproject_db101'#'localhost' (using password: YES)
(View: /home/vagrant/Projects/myproject/resources/views/layout/index.blade.php)
(View: /home/vagrant/Projects/myproject/resources/views/layout/index.blade.php)
How can I fix this?
I was facing the same issue and I tried below steps to fix it. Please let me know if they work for you.
Note the homestead ip address for your vagrant box. It is available in Homestead.yaml file under ~/.homestead directory. This directory location would be different on different OS. But since you have already installed vagrant with homestead you should know its location. For me the ip address was 192.168.10.10.
Open up the Mysql Connection wizard and provide the below settings
hostname = 192.168.10.10
port = 3306
username = homestead
password = secret
Test Your connection
For me these settings worked. Check if they work for you.
These other answers might have worked for you guys, but in case anyone has a case like mine, I'm just going to provide what worked for me. Hopefully it helps someone out. I'm working on a brand new homestead installation as of today, but on a very old mac in case thats relevant.
What worked for me was using the regular localhost ip of my machine as the host, and then the homested/secret combination for the password, and using the default port but with a 0 at the end.
This adds up to be the following settings:
Connection method: Standard (TCP/IP)
Host: 127.0.0.1
Username: homestead
Password: secret
Port: 33060
Hopefully this helps someone out. Its the only configuration that worked for me.
Try using homestead's default MySQL credentials: User: root Password: secret
If you are accessing the database from your computer via MySQL Workbench (not from within the homestead VM), you can use localhost:33060 (note: non-standard port). This is mapped to port 3306 within your VM.
From your application and any time you're working from within the homestead VM, you can connect to the database normally as localhost on port 3306.
Very likely a configuration issue. Either the user 'myproject_db101'#'localhost' has no password set or is not allowed to connect from localhost. You need another user with proper rights (e.g. the root user) to fix permissions for that user.

Unable to access the database of homestead environment (laravel) through MYSQL workbench

Unable to access the homestead database through MYSQL workbench Please help me out to solve this issue
error messages at time of testing the connection - "Failed to Connect to MySQL at 127.0.0.1:33060 with user homestead Lost connection to MySQL server at 'reading initial communication packet', system error: 0"
please take a note that
Bind address in my.cnf file is 127.0.0.1 (my.cnf file located at /etc/mysql/)
hosts file contains: 127.0.0.1 localhost projectname (which is located at /etc/)
I have tried changing bind address to 0.0.0.0 but it was also not worked.
Actually I was keep trying to setup the database connectivity by just considering the homestead environment ... But on Keep searching I found one link http://www.acnenomor.com/171821p1/laravel-homestead-vagrant-box-database-problems from where I got idea and I tried once again with the data shown in attached image and it worked for me ... so I am sharing this answer in general .. it may help someone...
Please take a note that I have also tried to connect the database of Laravel homestead environment by installing all the stuffs in other system too and it was worked fine as described in the official document.. so in my case it might be the problem of some changes in configuration file of mysql or any other related environment... so please first go through the official document... http://laravel.com/docs/4.2/homestead#daily-usage
The first thing you need to do is
vagrant up
and then use these connections below for a default homestead installation.
Connection Method: Standard (TCP/IP)
Hostname: 127.0.0.1
Port: 33060
Username: homestead
Password: secret
Try the alternate IP of 192.168.10.10
hostname = 192.168.10.10
port = 3306
username = homestead
password = secret
This works for me on Windows 10 Home Version 20H2 OS Build 19042.1165 (To find this information navigate to Start, Type 'About' and click 'About your PC').
ran into a similar problem while trying to use SQLyog on my windows machine to connect to mySQL on a Homestead environment. I was able to resolve this issue by adding
skip-name-resolve
to the VMs /etc/mysql/my.conf file.
Apparently (according the mysql error logs) connections from the local machine were coming from '10.0.2.2', which caused the warning "IP Address '10.0.0.2' could not be resolved".
You will need to re-add this line every time you spin up the environment.

Xcode error: failed to launch [directory] - invalid host string: 'localhost'

I'm trying to run a C++ project, but I get this "invalid host string: localhost" error.
here is my /ect/hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
Even though, I'm still getting the error. Thanks in advance.
I have the same problem.
I have found these solutions online that worked for other people, maybe it will work for you.
Link:
http://ubuntuforums.org/showthread.php?t=1896148
https://superuser.com/questions/354902/etc-hosts-getting-reset-in-lion/379560#379560
If anyone else has another other suggestions, I am all ears too because I am still facing this exact same issue.
Edit:
I found my solution to the issue. My host file was saved as a .rtf file instead of .txt format. After I made the correction, everything worked. Maybe this will help you. Good luck!

Resources