I am trying to connect and create schema using TablePlus (or PhpStorm) in my database since May of 6. Please understand me what I should to do? I will discribe what did I do step by step.
$ laravel new app
. I have got /app/ folder with my new project.cd app/
to enter this folder.composer require laravel/sail --dev
to receive Laravel Sail.php artisan sail:install
. There terminal asks me Which services I would like to install?. I writemysql
and press Enter.gedit .env
to open .env file to see connection settings.
APP_ENV=local
APP_KEY=base64:fXZ06W8BPoRShk8cYlHgS0u/+IBIZTSOM20gFRON6d4=
APP_DEBUG=true
APP_URL=http://app.test
LOG_CHANNEL=stack
LOG_LEVEL=debug
DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=app
DB_USERNAME=sail
DB_PASSWORD=password
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120
MEMCACHED_HOST=memcached
REDIS_HOST=redis
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
gedit docker-compose.yml
to see these setting here.
# For more information: https://laravel.com/docs/sail
version: '3'
services:
laravel.test:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: sail-8.0/app
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
volumes:
- '.:/var/www/html'
networks:
- sail
depends_on:
- mysql
mysql:
image: 'mysql:8.0'
ports:
- '${FORWARD_DB_PORT:-3306}:3306'
environment:
MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}'
MYSQL_DATABASE: '${DB_DATABASE}'
MYSQL_USER: '${DB_USERNAME}'
MYSQL_PASSWORD: '${DB_PASSWORD}'
MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
volumes:
- 'sailmysql:/var/lib/mysql'
networks:
- sail
healthcheck:
test: ["CMD", "mysqladmin", "ping"]
networks:
sail:
driver: bridge
volumes:
sailmysql:
driver: local
sail up -d
to run Sail.- Run TablePlus to connect to the database. What should I write in host? When i write mysql I am getting error "Unknown MySQL server
mysql
". Please help!
From TablePlus, the host connecting to would be
127.0.0.1
.mysql
is a host name inside the Docker Compose network which TablePlus can not access to.ref. https://docs.docker.com/compose/networking/