{"id":1538,"date":"2020-03-05T12:26:56","date_gmt":"2020-03-05T03:26:56","guid":{"rendered":"https:\/\/qol-kk.com\/wp2\/?p=1538"},"modified":"2020-03-05T12:26:56","modified_gmt":"2020-03-05T03:26:56","slug":"post-1538","status":"publish","type":"post","link":"https:\/\/qol-kk.com\/wp2\/blog\/2020\/03\/05\/post-1538\/","title":{"rendered":"Docker-MySQL\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u6700\u521d\u304b\u3089\u683c\u7d0d\u3057\u3066\u30b3\u30f3\u30c6\u30ca\u3092\u5c55\u958b\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<h2>Docker-MySQL\uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30b3\u30d4\u30fc\u3057\u3066\u30b3\u30f3\u30c6\u30ca\u5c55\u958b\u3059\u308b\u65b9\u6cd5<\/h2>\n<p>\u3084\u308a\u305f\u304b\u3063\u305f\u3053\u3068\u306f\u300e\u30b5\u30a4\u30c8\u306e\u79fb\u52d5\u300f\u3067\u3059\u3002<\/p>\n<p>\u65e2\u5b58\u30b7\u30b9\u30c6\u30e0\u306eDocker\u30b3\u30f3\u30c6\u30ca\u5316\u3092\u76ee\u6307\u3057\u305f\u305f\u3081\u3001\u305d\u3082\u305d\u3082\u4f5c\u6210\u3057\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u30b7\u30b9\u30c6\u30e0\u81ea\u4f53\u306fLaravel\u3067\u69cb\u7bc9\u3057\u3066\u3044\u308b\u306e\u3067\u3010 php artisan migrate \u3011\u3067\u30c6\u30fc\u30d6\u30eb\u4f5c\u6210\u3057\u3066\u304f\u308c\u307e\u3059\u304c\u3001\u65e2\u306b\u767b\u9332\u3057\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306eseeder\u3092\u4f5c\u308b\u306e\u306f\u6b63\u76f4\u3057\u3093\u3069\u3044\u3002<br \/>\n\u306a\u306e\u3067\u3001\u30b3\u30d4\u30fc\u3067\u304d\u306a\u3044\u304b\u3068\u8a66\u884c\u932f\u8aa4\u3057\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<p>\u6b63\u76f4\u8272\u3005\u306a\u66f8\u304d\u65b9\u304c\u3042\u308b\u306e\u3060\u3068\u601d\u3044\u307e\u3059\u3002Dockerfile\u3067\u5c55\u958b\u3057\u3066\u3044\u308b\u4eba\u3082\u3044\u307e\u3059\u304c\u3001\u79c1\u306fdocker-compose\u3092\u5229\u7528\u3057\u305f\u4f5c\u6210\u65b9\u6cd5\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<h3>Docker\uff0dMySQL\u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30b3\u30d4\u30fc\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9<\/h3>\n<p>\u5b8c\u6210\u3059\u308b\u307e\u3067\u306e\u8a66\u884c\u932f\u8aa4\u306e\u4e2d\u3067\u3001\u4eca\u306b\u306a\u3063\u3066\u601d\u3048\u3070\u300e\u30b3\u30fc\u30c9\u306f\u3042\u3063\u3066\u3044\u305f\u306e\u306b\u52d5\u304b\u306a\u3044\u300f\u6642\u304c\u3042\u308a\u307e\u3057\u305f\u3002<br \/>\n\u3053\u308c\u3070\u304b\u308a\u306f\u77e5\u3089\u306a\u3044\u3068\u51fa\u6765\u306a\u3044\u4e8b\u306a\u306e\u3067\u3001\u6ce8\u610f\u70b9\u3068\u3057\u3066\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n<div class=\"paperBox\">\n<ol>\n<li>\/docker-entrypoint-initdb.d \u5185\u306e\u5b9f\u884c\u9806\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u9806<\/li>\n<li>volumes: \u3067\u660e\u793a\u3057\u305fDirectory\u306f docker-entrypoint-initdb.d\u304b\u3089\u898b\u3048\u306a\u3044\u6642\u304c\u3042\u308b\u3002<\/li>\n<\/ol>\n<\/div>\n<p>\u4ee5\u964d\u3001\u8a73\u7d30\u3092\u5099\u5fd8\u9332\u3068\u3057\u3066\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n<h3>1. \/docker-entrypoint-initdb.d \u5185\u306e\u5b9f\u884c\u9806\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u9806<\/h3>\n<p>\u79c1\u304c\u30cf\u30de\u3063\u3066\u3057\u307e\u3063\u305f\u7406\u7531\u304c\u3053\u306e\u5b9f\u884c\u9806\u30eb\u30fc\u30eb\u3092\u77e5\u3089\u306a\u304b\u3063\u305f\u4e8b\u3067\u3059\u3002<\/p>\n<p>\u3088\u304f\u8003\u3048\u308c\u3070\u7591\u554f\u3092\u6301\u305f\u306a\u304d\u3083\u3044\u3051\u306a\u3044\u5185\u5bb9\u3067\u3057\u305f\u304c\u3001\u305d\u3053\u307e\u3067\u982d\u304c\u56de\u3089\u306a\u304b\u3063\u305f...\u3002<br \/>\n\u89e3\u3089\u306a\u904e\u304e\u3066\u30c6\u30f3\u30d1\u3063\u3066\u305f\u3093\u3067\u3057\u3087\u3046\u306d\u3002<\/p>\n<h4>image\u4f5c\u6210\u6642\u306b\u8aad\u8fbc\u3080docker-entrypoint-initdb.d\u306e\u767b\u9332<\/h4>\n<p>docker-entrypoint-initdb.d \u306b\u767b\u9332\u3057\u305f\u5185\u5bb9\u306f\u30a4\u30e1\u30fc\u30b8\u4f5c\u6210\u6642\u306b1\u5ea6\u3060\u3051\u7d44\u307f\u8fbc\u307e\u308c\u308b\u5185\u5bb9\u3068\u306a\u308a\u307e\u3059\u3002<br \/>\nDockerfile\u306eRUN\u3068\u540c\u3058\u3067\u3059\u3002<\/p>\n<p>docker-compose.yml \u306b\u4ee5\u4e0b\u306e\u69d8\u306b\u8a18\u8f09\u3059\u308b\u4e8b\u3067\u3001\u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092docker-entrypoint-initdb.d\u3068\u3057\u3066\u30de\u30a6\u30f3\u30c8\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">  mysql:\r\n    image: mysql:5.7\r\n    volumes:\r\n      - .\/docker\/mysql\/entrypoint\/:\/docker-entrypoint-initdb.d\r\n    restart: always\r\n    env_file: .\/docker\/mysql\/.env.dev\r\n    ports:\r\n      - \"3306:3306\"<\/pre>\n<p>\u4e0a\u3067\u306f\u30db\u30b9\u30c8OS\u5185\u306e .\/docker\/mysql\/entrypoint\/\u3068\u3044\u3046\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092docker-entrypoint-initdb.d\u3068\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4>docker-entrypoint-initdb.d\u5185\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u8fbc\u30eb\u30fc\u30eb<\/h4>\n<p>docker-entrypoint-initdb.d\u306b\u8a18\u8f09\u3057\u305f\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u30eb\u30fc\u30eb\u3067\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3059\u3002<\/p>\n<div class=\"borderBox\">\n<ol>\n<li>\u62e1\u5f35\u5b50\u3010.sql\u3011\u3010.sh\u3011\u3010.sql.gz\u3011\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u5bfe\u8c61\u306b\u8aad\u8fbc\u5b9f\u884c<\/li>\n<li>\u8aad\u8fbc\u3080\u9806\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u30bd\u30fc\u30c8\u9806<\/li>\n<li>\u3010.sql\u3011\u306f\u30b3\u30f3\u30c6\u30ca\u304b\u3089mysql\u306broot\u30ed\u30b0\u30a4\u30f3\u3057\u305f\u72b6\u614b\u3067\u3001\u305d\u306e\u307e\u307e\u306e\u6587\u3092\u5b9f\u884c<\/li>\n<li>\u3010.sh\u3011\u306f\u30b3\u30f3\u30c6\u30ca\u4e0a\u3067\uff08mysql\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u3044\u306a\u3044\u72b6\u614b\u3067\uff09\u305d\u306e\u307e\u307e\u306e\u6587\u3092\u5b9f\u884c<\/li>\n<li>\u3010.sql.gz\u3011\u306f\u5727\u7e2e\u3092\u89e3\u51cd\u3057\u3001\u4e2d\u8eab\u306e .sql \u3084 .sh \u3092\u5b9f\u884c<\/li>\n<\/ol>\n<\/div>\n<p>\/docker-entrypoint-initdb.d \u3068\u3057\u3066\u30de\u30a6\u30f3\u30c8\u3057\u305fDirectory\u306e\u4e2d\u8eab\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u30bd\u30fc\u30c8\u3055\u308c\u305f\u9806\u306b\u5b9f\u884c\u3055\u308c\u308b\u3002<\/p>\n<p>\u3053\u308c\u3092\u65e9\u304f\u306b\u77e5\u3063\u3066\u3044\u308c\u3070...\u3002<\/p>\n<h4 style=\"font-family: Lato, \u6e38\u30b4\u30b7\u30c3\u30af\u4f53, 'Yu Gothic', YuGothic, '\u30d2\u30e9\u30ae\u30ce\u89d2\u30b4\u30b7\u30c3\u30af Pro', 'Hiragino Kaku Gothic Pro', \u30e1\u30a4\u30ea\u30aa, 'Meiryo, Osaka', '\uff2d\uff33 \uff30\u30b4\u30b7\u30c3\u30af', 'MS PGothic', sans-serif;\">\u00a0\u79c1\u304c\u6700\u521d\u306b\u69cb\u6210\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u540d\uff08\u30a8\u30e9\u30fc\u539f\u56e0\u306e\u8003\u5bdf\uff09<\/h4>\n<div class=\"paperBox\">\n<p>\u30d5\u30a1\u30a4\u30eb\u540d\uff1acreate_user.sql \u3067\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057<br \/>\n\u30d5\u30a1\u30a4\u30eb\u540d\uff1acreate_database.sql \u3067\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057<br \/>\n\u30d5\u30a1\u30a4\u30eb\u540d\uff1acopy_database.sh \u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30b3\u30d4\u30fc\u3059\u308b<\/p>\n<\/div>\n<p>\u3053\u3093\u306a\u8a2d\u8a08\u3092\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u5834\u5408\u3001\u30d5\u30a1\u30a4\u30eb\u540d\u3067\u4e26\u3073\u66ff\u3048\u308b\u3068\u6700\u521d\u306b\u3010copy_database.sh\u3011\u304c\u8d70\u308b\u4e8b\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u53ce\u7d0d\u3059\u308b\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u7121\u3044\u306e\u306b...\u3002<\/p>\n<h4>\u30eb\u30fc\u30eb\u3092\u8003\u616e\u3057\u5909\u66f4\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u540d\uff08\u30a8\u30e9\u30fc\u539f\u56e0\u306e\u4fee\u6b63\uff09<\/h4>\n<div class=\"paperBox\">\n<p>\u30d5\u30a1\u30a4\u30eb\u540d\uff1a01_create_user.sql \u3067\u30e6\u30fc\u30b6\u30fc\u3092\u4f5c\u6210\u3057<br \/>\n\u30d5\u30a1\u30a4\u30eb\u540d\uff1a02_create_database.sql \u3067\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210\u3057<br \/>\n\u30d5\u30a1\u30a4\u30eb\u540d\uff1a03_copy_database.sh \u3067\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30b3\u30d4\u30fc\u3059\u308b<\/p>\n<\/div>\n<p>\u3053\u306e\u3088\u3046\u306b\u5148\u982d\u306b\u756a\u53f7\u3092\u632f\u308b\u3060\u3051\u3067\u610f\u56f3\u3057\u305f\u5b9f\u884c\u9806\u306b\u3059\u308b\u4e8b\u304c\u51fa\u6765\u307e\u3059\u3002<\/p>\n<p>\u3044\u3084\u3041\uff5e\u3053\u3053\u307e\u3067\u3057\u3093\u3069\u304b\u3063\u305f...\u3002<\/p>\n<h3>2. volumes: \u3067\u660e\u793a\u3057\u305fDirectory\u306f docker-entrypoint-initdb.d\u304b\u3089\u898b\u3048\u306a\u3044\u6642\u304c\u3042\u308b<\/h3>\n<p>\u79c1\u304c\u30cf\u30de\u3063\u3066\u3044\u305f\u3082\u3046\u4e00\u500b\u306e\u7406\u7531\u304c\u3053\u308c\u3067\u3059\u3002<\/p>\n<p>Dockerfile\u3067\u66f8\u3044\u3066\u307f\u305f\u308a\u3001docker-compose\u3067\u66f8\u3044\u3066\u307f\u305f\u308a\u3068\u884c\u3063\u305f\u308a\u6765\u305f\u308a\u3057\u305f\u306e\u3067\u982d\u304c\u30b0\u30c1\u30e3\u30b0\u30c1\u30e3\u3057\u305f\u306e\u3067\u3057\u3087\u3046\u3002<\/p>\n<h4>\u5b9f\u969b\u306b\u8a18\u8f09\u3057\u3066\u3044\u305f docker-compose.yml<\/h4>\n<pre class=\"lang:default decode:true\">  mysql:\r\n    image: mysql:5.7\r\n    volumes:\r\n      - .\/docker\/mysql\/backup_sql\/:\/Backup_SQL\r\n      - .\/docker\/mysql\/entrypoint\/:\/docker-entrypoint-initdb.d\r\n    restart: always\r\n    env_file: .\/docker\/mysql\/.env.dev\r\n    ports:\r\n      - \"3306:3306\"<\/pre>\n<p>\u610f\u56f3\u3057\u305f\u4e8b\u306f\u30db\u30b9\u30c8OS\u306e.\/docker\/mysql\/backup_sql\/ \u3092 \u30b3\u30f3\u30c6\u30ca\u5185 Backup_SQL \u3068\u3057\u3066\u30de\u30a6\u30f3\u30c8\u3059\u308b\u4e8b\u3002<br \/>\n\u5b9f\u969b\u306b\u3053\u308c\u3092\u66f8\u3044\u3066mysql\u30b3\u30f3\u30c6\u30ca\u306b\u5165\u308a ls \u3067\u30d5\u30a9\u30eb\u30c0\u69cb\u6210\u3092\u78ba\u8a8d\u3059\u308b\u3068\u3061\u3083\u3093\u3068\u30de\u30a6\u30f3\u30c8\u3055\u308c\u307e\u3059\u3002<\/p>\n<h4>DB\u304c\u4f5c\u6210\u3055\u308c\u306a\u304b\u3063\u305f\u301003_copy_database.sh\u3011\u306e\u66f8\u304d\u65b9\uff08\u30a8\u30e9\u30fc\u539f\u56e0\u306e\u8003\u5bdf\uff09<\/h4>\n<pre class=\"lang:default decode:true\">mysql -u root -ppassword database01 &lt; \/Backup_SQL\/Backup_database01.sql<\/pre>\n<p>\u25a0Workspase\u306e\u30a4\u30e1\u30fc\u30b8<\/p>\n<div class=\"bgBox\">Laravel-Docker<br \/>\n\u251c\u2500\u2500 docker\/<br \/>\n\u2502\u00a0 \u2514\u2500\u2500 mysql\/<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 data\/<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 entrypoint\/<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u251c\u2500\u2500 01_create_user.sql.sql<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u251c\u2500\u2500 02_create_database.sql.sql<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u2514\u2500\u2500 03_copy_database.sh<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 backup_sql<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u251c\u2500\u2500 Backup_database01.sql_<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u2514\u2500\u2500 Backup_database02.sql_<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 .env<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2514\u2500\u2500 my.cnf<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 docker-compose.yml<br \/>\n\u2514\u2500\u2500 Laravel # \u914d\u4fe1\u3059\u308bLaravel\u30b3\u30f3\u30c6\u30f3\u30c4<\/div>\n<p>Backup_database01.sql \u306f .\/docker\/mysql\/backup_sql\/\u5185\u306b\u4fdd\u5b58\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<h4>\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u4fdd\u5b58\u5834\u6240\u3092\u5909\u3048\u305f\u3089\u30b3\u30d4\u30fc\u5b9f\u884c\u3092\u5b8c\u4e86\uff08\u30a8\u30e9\u30fc\u539f\u56e0\u306e\u4fee\u6b63\uff09<\/h4>\n<p>\u8272\u3005\u8a66\u3057\u305f\u4e2d\u3067\u3001\u4e0a\u624b\u304f\u3044\u3063\u305f\u306e\u304c docker-entrypoint-initdb.d\u3068\u3057\u3066\u30de\u30a6\u30f3\u30c8\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u30b3\u30d4\u30fc\u3057\u305f\u3044\u30d0\u30c3\u30af\u30a2\u30c3\u30d7SQL\u3092\u683c\u7d0d\u3059\u308b\u4e8b\u3067\u3057\u305f\u3002<\/p>\n<p>\u305f\u3060\u3001\u62e1\u5f35\u5b50\u3010.sql\u3011\u306f\u81ea\u52d5\u3067\u8aad\u307f\u8fbc\u307e\u308c\u3066\u3057\u307e\u3046\u305f\u3081\u3001\u62e1\u5f35\u5b50\u3092\u3010.sql_\u3011\u3068\u5909\u66f4\u3057\u8aad\u307f\u8fbc\u307e\u308c\u306a\u3044\u69d8\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u25a0Workspase\u306e\u30a4\u30e1\u30fc\u30b8<\/p>\n<div class=\"bgBox\">\n<p>Laravel-Docker<br \/>\n\u251c\u2500\u2500 docker\/<br \/>\n\u2502\u00a0 \u2514\u2500\u2500 mysql\/<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 data\/<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 entrypoint\/<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u251c\u2500\u2500 01_create_user.sql.sql<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u251c\u2500\u2500 02_create_database.sql.sql<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u251c\u2500\u2500 03_copy_database.sh<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u251c\u2500\u2500 Backup_database01.sql_<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2502\u00a0 \u2514\u2500\u2500 Backup_database02.sql_<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u251c\u2500\u2500 .env<br \/>\n\u2502\u00a0 \u00a0 \u00a0 \u2514\u2500\u2500 my.cnf<br \/>\n\u2502<br \/>\n\u251c\u2500\u2500 docker-compose.yml<br \/>\n\u2514\u2500\u2500 Laravel # \u914d\u4fe1\u3059\u308bLaravel\u30b3\u30f3\u30c6\u30f3\u30c4<\/p>\n<\/div>\n<p>\u25a003_copy_database.sh<\/p>\n<pre class=\"lang:default decode:true\">mysql -u root -ppassword database01 &lt; docker-entrypoint-initdb.d\/Backup_database01.sql_\r\nmysql -u root -ppassword database02 &lt; docker-entrypoint-initdb.d\/Backup_database02.sql_<\/pre>\n<h4>\u9006\u7b97\u3057\u3066\u6d6e\u304b\u3093\u3060\u539f\u56e0\u306f docker-entrypoint-initdb.d\u304b\u3089\u898b\u3048\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea<\/h4>\n<p>\u6839\u672c\u539f\u56e0\u306f\u5225\u306b\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<br \/>\n\u3057\u304b\u3057\u3001\u540c\u3058Command\u3067\u3082\u51fa\u6765\u306a\u304b\u3063\u305f\u3068\u8003\u3048\u308b\u3068\u539f\u56e0\u306f\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306f\u306a\u304f\u3010Backup_database01.sql\u3011\u304c\u8aad\u8fbc\u3081\u305f\u304b\u5426\u304b\u306a\u306e\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<p>\u3068\u306a\u308b\u3068\u3001\u30b3\u30f3\u30c6\u30ca\u4f5c\u6210\u6642\u306b\u8aad\u8fbc\u3080 volumes: \u306b\u3082\u9806\u756a\u304c\u3042\u308a\u3001\u305d\u308c\u306b\u6e96\u3058\u3066\u3044\u306a\u3044\u305f\u3081\u898b\u3048\u306a\u304b\u3063\u305f\u306e\u304b\u3082\u3057\u308c\u306a\u3044\u3068\u8003\u3048\u3066\u3044\u307e\u3059\u3002<br \/>\n\u307e\u3041\u3001docker-entrypoint-initdb.d\u3068\u3057\u3066\u30de\u30a6\u30f3\u30c8\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u4e2d\u306b\u53ce\u3081\u3066\u3057\u307e\u3048\u3070\u89e3\u6c7a\u3059\u308b\u306e\u3060\u304b\u3089\u614b\u3005\u5225\u306b\u3057\u3066\u4e0d\u5b89\u5b9a\u306b\u3059\u308b\u5fc5\u8981\u306f\u306a\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210\u3068\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4f5c\u6210\u306e .sql \u30c7\u30fc\u30bf\u3092\u30e1\u30e2<\/h3>\n<p>\u81ea\u5206\u306e\u5099\u5fd8\u9332\u3067\u3082\u3042\u308b\u306e\u3067\u3001\u3064\u3044\u3067\u306b\u30e1\u30e2\u3057\u307e\u3059\u3002<\/p>\n<p>\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u5bfe\u3059\u308b\u6a29\u9650\u8a2d\u5b9a\u3082\u3057\u305f\u304b\u3063\u305f\u305f\u3081\u3001\u6700\u7d42\u7684\u306b\u306f 01_create_user.sql.sql \u3068 02_create_database.sql \u306f\u5408\u6210\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u25a0\u30e6\u30fc\u30b6\u30fc\u4f5c\u6210 \uff06 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u4f5c\u6210 \uff06 \u6a29\u9650\u8a2d\u5b9a<\/p>\n<pre class=\"lang:default decode:true\">---- create user ----\r\nCREATE USER 'user01'@'%' identified by 'password';\r\nCREATE USER 'user02'@'mysql' identified by 'password';\r\n\r\n---- create user ----\r\nCREATE DATABASE IF not exists `database01` character set utf8;\r\nCREATE DATABASE IF not exists `database02` character set utf8;\r\n\r\n---- create Authorisation ----\r\nGRANT ALL on *.* to 'user01'@'%';\r\nGRANT ALL on database01.* to 'user02'@'mysql';\r\nGRANT ALL on database02.* to 'user02'@'mysql';<\/pre>\n<p>\u3053\u306e\u5f8c\u306bshell\u3092\u8d70\u3089\u305b\u307e\u3059\u3002<\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u771f\u9762\u76ee\u306b\u9577\u304b\u3063\u305f...\u3002<\/p>\n<p>\u30b0\u30b0\u308b\u3068shell\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092 \u3010docker-run \u3011\u3068\u66f8\u304d\u59cb\u3081\u3066\u308b\u4eba\u304c\u3044\u305f\u308a\u3010RUN \u3011\u3067\u59cb\u3081\u3066\u308b\u4eba\u304c\u3044\u305f\u308a\u3010mysql -u name -p\u3011\u3092\u8a18\u8f09\u3057\u306a\u3044\u3067\u30e1\u30e2\u3057\u3066\u308b\u4eba\u304c\u3044\u305f\u308a\u3002\u8aad\u307f\u8fbc\u3080\u5834\u6240\u306b\u3088\u3063\u3066\u66f8\u304d\u65b9\u304c\u5909\u308f\u308b\u304b\u3089\u3057\u3087\u3046\u304c\u306a\u3044\u306e\u3060\u308d\u3046\u3051\u3069\u3001\u52c9\u5f37\u3057\u59cb\u3081\u306e\u79c1\u304b\u3089\u3059\u308b\u3068\u6df7\u4e71\u306e\u3082\u3068\u3067\u3057\u305f\u3002<\/p>\n<p>\u8ff7\u8d70\u3057\u305f\u306a\u3041\uff5e\u3002<\/p>\n<p>\u307e\u3041\u3001\u5b9f\u88c5\u51fa\u6765\u3066\u7406\u89e3\u3082\u9032\u3093\u3060\u304b\u3089\u826f\u3057\u3068\u3059\u308b\u304b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Docker-MySQL\uff1a\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30b3\u30d4\u30fc\u3057\u3066\u30b3\u30f3\u30c6\u30ca\u5c55\u958b\u3059\u308b\u65b9\u6cd5 \u3084\u308a\u305f\u304b\u3063\u305f\u3053\u3068\u306f\u300e\u30b5\u30a4\u30c8\u306e\u79fb\u52d5\u300f\u3067\u3059\u3002 \u65e2\u5b58\u30b7\u30b9\u30c6\u30e0\u306eDocker\u30b3\u30f3\u30c6\u30ca\u5316\u3092\u76ee\u6307\u3057\u305f\u305f\u3081\u3001\u305d\u3082\u305d\u3082\u4f5c\u6210\u3057\u305f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u3042\u308a\u307e\u3059\u3002 \u30b7\u30b9\u30c6\u30e0\u81ea\u4f53 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1502,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"vkexunit_cta_each_option":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[75],"tags":[498,153,99,515,53,517,500,45,68],"class_list":["post-1538","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code-of-serverside","tag-docker","tag-laravel","tag-mysql","tag-515","tag-53","tag-517","tag-500","tag-45","tag-68"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/qol-kk.com\/wp2\/wp-content\/uploads\/2020\/02\/https___www.creationline.com_wp-content_uploads_2018_06_Moby2018.png","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1538","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/comments?post=1538"}],"version-history":[{"count":0,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/posts\/1538\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media\/1502"}],"wp:attachment":[{"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/media?parent=1538"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/categories?post=1538"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qol-kk.com\/wp2\/wp-json\/wp\/v2\/tags?post=1538"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}