Search code examples
mysqldockerconnectionsequelpro

How to connect Sequel Pro (on a Mac) to a MySQL in a Docker


At my new job I was given a Mac (Mac Mini M1 with Big Sur), whereas I've used Windows and some Linux my whole life. First week yet.

I have a working Docker container with mysql-server and also PhpMySql.

Nevertheless I wanted to use Sequel Pro locally to connect to Mysql and I'm failing completely. Screenshot of error: "Connection failed! Unable to connect to host 127.0.0.1, or the request timed out."

I've installed mysql-client with Homebrew and I'm able to connect with docker's mysql without any problem using:

mysql -h 127.0.0.1 -u sail -p

My .env file is as follows:

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel8vue
DB_USERNAME=sail
DB_PASSWORD=password

My docker-compose.yml (version 3) related to mysql is as follows:

mysql:
    image: 'mysql/mysql-server:8.0.26'
    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'
    restart: unless-stopped
    networks:
        - sail
    healthcheck:
        test: ["CMD", "mysqladmin", "ping", "-p${DB_PASSWORD}"]
        retries: 3
        timeout: 5s

My Sequel Pro using the standard tab with the following settings (screenshot):

Host: 127.0.0.1 Username: sail Password: password Database: laravel8vue Port: 3306

How is it possible that I can connect with mysql-client but not with Sequel Pro? What am I missing?

Thank you for your time!


Solution

  • I have given up on Sequel Pro.

    Sequel Ace is an open source alternative in the same style.

    https://github.com/Sequel-Ace/Sequel-Ace

    It is graphically the same, and it worked straight away!