changeweb / Unifiedtransform

A school management Software
https://changeweb.github.io/Unifiedtransform/
GNU General Public License v3.0
2.8k stars 1.23k forks source link

SQLSTATE[HY000] [2002] Host is unreachable (SQL: SHOW FULL TABLES WHERE table_type = 'BASE TABLE') #303

Open sjsajju opened 3 years ago

sjsajju commented 3 years ago

Trying to run the project with the docker. Followed the steps and copied values into .env file. after that ran the sudo ./docker-install.sh command. At the very end of the setup process i get the above mentioned error. Now I don't understand where the issue lies. Would request someone to please have a look and help me out why such an issue is occurring. It seems like the DB is not rightly set up but why I don't understand. Here is the screenshot of what I see when logged in:

Screenshot 2021-06-14 at 5 41 15 PM

And here is what I am seeing on my terminal:

Screenshot 2021-06-14 at 5 42 04 PM

Any help would be highly appreciated.

handhikadj commented 3 years ago

I'm the pull requester of the new Docker setup Kindly share your .env so I could give insight on this

kanishk09 commented 3 years ago

Facing the same issue and using the default env file:

APP_NAME=UnifiedTransform
APP_ENV=local
APP_KEY=base64:JZLAgKJlzf/7V/2FlwvmNfh6xAp9bvtq7vZpMwIjhmk=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=school
DB_USERNAME=root
DB_PASSWORD=schoolapp

DOCKER_WEBSERVER_HOST=4049
DOCKER_PHPMYADMIN_HOST=5051

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=120
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

STRIPE_KEY=
STRIPE_SECRET=
vyrral commented 3 years ago

make your .env file like this in like 8:

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=unifiedtransform DB_USERNAME=root DB_PASSWORD=

enjoy!

vyrral commented 3 years ago

also make sure you dont edit:

"APP_NAME=UnifiedTransform"

handhikadj commented 3 years ago

@sjsajju Are you able to access the Docker mysql through the Docker phpmyadmin?

dinesh46 commented 3 years ago

@sjsajju Not sure if you resolved this. the problem is my sql thinks you are trying to add a user instead of setting the root user password. current docker-composer.yml file MYSQL_ROOT_PASSWORD: ${DB_PASSWORD} MYSQL_USER: ${DB_USERNAME} MYSQL_PASSWORD: ${DB_PASSWORD} you can fix this by changing the .env file

DB_CONNECTION=mysql DB_HOST=db DB_PORT=3306 DB_DATABASE=school DB_USERNAME=Something else than root DB_PASSWORD=schoolapp

also note the root password will be same as alternative user password for db.

handhikadj commented 3 years ago

a bugfix has been merged to master on #312 kindly re-pull and confirm if this issue still persists Tested on Ubuntu 20.04 (VPS Server), Docker version 20.10.7 and docker-compose version 1.27.4

changeweb commented 3 years ago

Docker setup seems to be broken right now. But manual installation instruction works properly.

handhikadj commented 3 years ago

@changeweb please give more detail about it

changeweb commented 3 years ago

@sjsajju I have found the fix. Replace DB_HOST=db with DB_HOST=localhost in .env file.

handhikadj commented 3 years ago

@changeweb then it will use mysql in your host machine instead of the mysql in docker