Answers for "docker compose file mysql"

SQL
3

mysql docker compose

version: 'X.X'
	services:  
    	db:    
        	image: mysql
            restart: always    
            environment:      
            	MYSQL_DATABASE: 'db' # So you don't have to use root, but you can if you like      
                MYSQL_USER: 'user' # You can use whatever password you like      
                MYSQL_PASSWORD: 'password' # Password for root access      
                MYSQL_ROOT_PASSWORD: 'password'    
           	ports: # <Port exposed> : < MySQL Port running inside container>      
             - '3306:3306'    
           	expose: # Opens port 3306 on the container      
             - '3306' # Where our data will be persisted    
           	volumes:      
             - my-db:/var/lib/mysql # Names our volume
           		volumes:  
           		y-db:
Posted by: Guest on March-22-2021
0

import sql in docker compose file

version: '3'

services:
  mysql:
    image: mariadb:10.3
    container_name: mariadb
    volumes:
      - container-volume:/var/lib/mysql
      - ./dump.sql:/docker-entrypoint-initdb.d/dump.sql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: name_db
    ports:
      - "3306:3306"

volumes:
  container-volume:
Posted by: Guest on July-26-2020

Code answers related to "SQL"

Browse Popular Code Answers by Language