Wednesday, February 16, 2022

Run MySQL 8 Using Docker Or Docker-Compose On Rocky Linux 8.5

 in This Tutorial you will Learn " How To Setup MySQL With Docker In Rocky Linux 8.5"

MySQL is a widely used, open-source relational database management system (RDBMS).
Docker is an open-source virtualization technology known a containerization platform for software containers.
Rocky Linux is an open-source enterprise operating system designed to be 100% bug-for-bug compatible with Red Hat Enterprise Linux®.
_________________________________________________________________________________________
Server - Os:  Rocky Linux 8.5  64Bit      |    IP -192.168.1.20        |     Hostname - www.primaryhost.com
_________________________________________________________________________________________
cat /etc/system-release ; sestatus ; dnf groupinstall "Development Tools" -y
docker --version ; docker-compose --version
docker pull mysql:latest
docker images mysql
docker run --name mysql -p 3306:3306 -v mysql_volume:/var/lib/mysql/ -d -e "MYSQL_ROOT_PASSWORD=temp123" mysql

netstat -tlnup | grep -i 3306
docker ps
docker exec -it mysql bash
mysql -u root -p
docker logs
_________________________________________________________________________________________
Run MySQL Using Docker-Compose
nano docker-compose.yaml
version: '3.9'

services:
  mysql:
    image: mysql:8
    ports:
      - 3306:3306
    volumes:
      - ~/apps/mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=S3cret
      - MYSQL_PASSWORD=An0thrS3crt
      - MYSQL_USER=citiz_user
      - MYSQL_DATABASE=citiz_db

docker-compose up -d
docker-compose ps
docker-compose exec mysql /bin/bash
mysql -u citiz_user -pAn0thrS3crt
select version();
_________________________________________________________________________________________

No comments:

Post a Comment