Last active
          January 8, 2025 23:14 
        
      - 
      
 - 
        
Save nicoavila/fd4725428bd2991bb9237b3c7d770e76 to your computer and use it in GitHub Desktop.  
    Docker Compose file for a MySQL 5.7 container
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | version: '3.3' | |
| services: | |
| database: | |
| image: mysql:5.7 | |
| container_name: mysql | |
| restart: always | |
| environment: | |
| MYSQL_DATABASE: 'db' | |
| MYSQL_USER: 'user' | |
| MYSQL_PASSWORD: 'password' | |
| MYSQL_ROOT_PASSWORD: 'password' | |
| ports: | |
| - '3306:3306' | |
| expose: | |
| - '3306' | |
| volumes: | |
| - './.mysql-data/db:/var/lib/mysql' | 
I want create root, is necesary add MYSQL_ROOT_USER: 'root' ??
Thanks!
this just worked perfectly for me, thanks for sharing.
Added this to build on macOS:
platform: linux/x86_64
    
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
I think this config missing
MYSQL_ROOT_HOST: '%'to allow root connecting from any address. Here is mine example: https://gist.github.com/jjromannet/9a5ee7e480801576b68af1ed5fd8e979