mariaDB μ„€μΉ˜ (feat. Docker)

· β˜• 1 min read · πŸ‘€... views

μ΄μƒν•˜κ²Œ λ§₯μ—μ„œ 둜컬 mysql 이든 mariadbλ“  λ‹€ μ œλŒ€λ‘œ μ„€μΉ˜κ°€ μ•ˆλ˜μ„œ,
μ£Όλ³€μ—μ„œ λ„μ»€λ‘œ μ„€μΉ˜ν•΄λ³΄λΌλŠ” μ–˜κΈ°λ₯Ό λ“£κ³ … λ„μ»€λ‘œ μ„€μΉ˜ 진행 (ν˜„μž¬ μ§„ν–‰λœ 뢀뢄도 μ‚½μ§ˆμ„ 많이 ν•˜λ©΄μ„œ μ™”κΈ° λ•Œλ¬Έμ—.. λ‹€μ‹œ μ„€μΉ˜ν•  경우 μ΅œμ†Œν•œ κ²€μƒ‰μ‹œκ°„μ΄λΌλ„ 쀄이기 μœ„ν•΄ 적어둔닀)

도컀 μ„€μΉ˜

mariadb OR mysql μ„€μΉ˜


# mysql
$ docker run --name mysql-db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secure -d mysql

# mariadb
$ docker run --name maria-db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secure -d mariadb

mariadb 도컀 μ»¨ν…Œμ΄λ„ˆ μ‹€ν–‰


docker container run -d -p 13306:3306     \
-e MYSQL_ROOT_PASSWORD=root         \
-v /Users/Shared/data/mariadb:/var/lib/mysql     \
--name mariadb_local mariadb

λ³Όλ₯¨ λ‘œμ»¬μ—μ„œ μ €μž₯ν•˜λŠ” 건 μ²˜μŒμ—λŠ” *-v pwd/wp_db:/var/lib/mysql * 뭐 μ΄λŸ°μ‹μœΌλ‘œ ν•˜λ €κ³  ν–ˆλŠ”λ° λ§₯μ—μ„œ μ§„ν–‰ν•˜λ‹ˆ κΆŒν•œμ΄λ‹ˆ λ­λ‹ˆ λ‚˜μ™€μ„œ λΉ λ₯΄κ²Œ 포기

μ»¨ν…Œμ΄λ„ˆ 접속


# 도컀에 μžˆλŠ” mysql μ»¨ν…Œμ΄λ„ˆ μ ‘κ·Ό
docker exec -it mariadb_local bash

# 접속방법
mysql -u root -p
 
# λ„μ»€λ‘œκ·Έ 보기
docker logs -f --tail=10 maria

μ»¨λ°μ΄λ„ˆ μ ‘μ†ν–ˆμ„ μ‹œ viκ°€ λ™μž‘ μ•ˆν•˜λ©΄..


apt-get update
apt-get install vim

###127.0.0.1:3306 으둜 접속이 μ•ˆλ  μ‹œ (포트 λ³€κ²½ λ°©λ²•μ•ŒκΈ° μ „κΉŒμ§€ μž„μ‹œ)
https://stackoverflow.com/questions/46069446/unable-to-connect-to-mysql-container-with-sequel-pro-client

Share on

snack
WRITTEN BY
snack
Web Programmer


What's on this Page