0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

dockerでmysql

Posted at

dockerにmysqlを作成した時の手順メモです。

network作成

docker network create app

永続化領域の作成

docker pull busybox
docker create -v /Users/xx/Project/appname/storage --name appstorage busybox

mysqlの構築

docker pull mysql
docker run --volumes-from appstorage --name appdb --network app -h appdb -p 3307:3306 -e MYSQL_ROOT_PASSWORD=password -d mysql
# タイムゾーン変更
docker exec appdb cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
docker exec appdb /bin/bash -c 'echo [mysqld_safe] >> /etc/mysql/my.cnf'
docker exec appdb /bin/bash -c 'echo timezone = JTC >> /etc/mysql/my.cnf'

DB作成

docker exec appdb /bin/bash -c "mysql -uroot -ppassword -e'create database appdb'"
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?