I’ve been told that many Laravel users choose to use a non-browser-based app for administering their Mysql databases.
But maybe you’re comfortable with PhpMyAdmin and don’t want to switch?
No big deal! I got you!
TL:DR
- If your Laravel Sail container is already running, bring it down. From your project root run:
.vendor/bin/sail down and wait for it to complete and return you to do the command line.
2. In your project root, find and open up docker-compose.yml and within the services block add the phpmyadmin service:
phpmyadmin:
image: phpmyadmin/phpmyadmin
links:
- mysql:mysql
ports:
- 8080:80
environment:
MYSQL_USERNAME: "${DB_USERNAME}"
MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
PMA_HOST: mysql
networks:
- sail
Indentation is critical in YAML files, so make sure it lines up with the mysql service. Save the file.
3. Go back to the command line and bring back up your Sail container with:
./vendor/bin/sail up
4. In your browser, navigate to localhost:8080 and phpmyadmin should load. The default user:pass for my Sail installation was sail:password, so you can try logging in with that.
Hope that works for you!