카테고리 없음

docker mariadb

EasyCoding 2021. 2. 16. 13:27
728x90

1. install docker from

www.docker.com/

 

Empowering App Development for Developers | Docker

Learn how Docker helps developers bring their ideas to life by conquering the complexity of app development.

www.docker.com

2. Run cmd and enter belows

docker pull mariadb

docker image ls

docker run --name mariadb -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=mariadb mariadb

mariadb : name of container

mariadb :password

mariadb : name of image file what we have downloaded

docker ps

docker exec -it mariadb /bin/bash

mysql -u root -p

password:mariadb

3. Install heidisql from

www.heidisql.com/download.php

 

Download HeidiSQL

Ads were blocked - no problem. But keep in mind that developing HeidiSQL, user support and hosting takes time and money. You may want to send a donation instead. Download HeidiSQL 11.2, released on 24 Jan 2021 Installer, 32/64 bit combined SHA1 checksum of

www.heidisql.com

4. Run heidisql and do below

click Right mouse on mariadb1 and create database

click Right mouse on dev and create table

Add id with default auto_increment

set primary_key

Relations beteween productid anf sellerid

 

Add data

 

Query

 

dump table query

mysqldump -u root -p myDB table1 table2 table3 > table.sql
 mysqldump -p --user=root dev t_category > t_category.sql

backup database

sudo mysqldump -u [user] -p [database_1] [database_2] [database_etc] > [filename].sql
mysqldump --single-transaction -u user -p DBNAME > backup.sql

copy file to local from docker

docker cp mariadb:t_category.sql .

Restore database

mysql -u [user] -p [database_name] < [filename].sql