Skip to content

Instantly share code, notes, and snippets.

@diogoko
Last active December 23, 2021 15:27
Show Gist options
  • Select an option

  • Save diogoko/621ceba223a1404de0c6bd12d1ed4f04 to your computer and use it in GitHub Desktop.

Select an option

Save diogoko/621ceba223a1404de0c6bd12d1ed4f04 to your computer and use it in GitHub Desktop.
Laravel Sail with phpMyAdmin

Add a new service:

services:
    ...
    phpmyadmin:
        image: 'phpmyadmin:5'
        ports:
            - '${FORWARD_PHPMYADMIN_PORT:-8888}:80'
        environment:
            PMA_HOST: 'mysql'
            PMA_USER: '${DB_USERNAME}'
            PMA_PASSWORD: '${DB_PASSWORD}'
            PMA_ABSOLUTE_URI: 'http://localhost:${FORWARD_PHPMYADMIN_PORT:-8888}/'
        volumes:
            - 'sailphpmyadmin:/sessions'
        networks:
            - sail

Add a new volume to store the session state:

volumes:
    ...
    sailphpmyadmin:
        driver: local

After running sail up, phpMyAdmin will be available at http://localhost:8888/. The port may be changed by setting the FORWARD_PHPMYADMIN_PORT environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment