解決したいこと
Dockerを使ってMySQLのコンテナを立てれるようにした。(これはできている)
MySQLにアクセスするコマンドを、「make mysql」のようにサブコマンドにしたかったが、やってみると、下記エラーが発生してできなかった。
make: Nothing to be done for `mysql'.
ソースコード
Makefile
.PHONY: mysql mysql: docker-compose exec mysql mysql -u root --password=passwd sample_db
docker-compose.yml
version: '3' services: mysql: image: mysql@sha256:870892ea5cc8c623b389717c2eedd58248c82a8569d7601ede62a63d527641bd environment: MYSQL_ROOT_PASSWORD: passwd volumes: - ./.tmp/docker/mysql/data:/var/lib/mysql - ./docker/mysql/init:/docker-entrypoint-initdb.d - ./docker/db/my.cnf:/usr/local/etc/my.cnf ports: - 3306:3306 command: --default-authentication-plugin=mysql_native_password
やったこと
下記コマンドは成功する。
% docker-compose exec mysql mysql -u root --password=passwd sample_db mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 10 Server version: 8.0.23 MySQL Community Server - GPL Copyright (c) 2000, 2021, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql>
しかし、下記コマンドは失敗する
% make mysql make: Nothing to be done for `mysql'.
問題が初歩的すぎるのか、自分があほなのか、
「make: Nothing to be done for ''」
これで検索すると、ヒットする情報はもっと難解な問題にぶち当たっているように見えるものしか見つけられず...
わかる方がいらっしゃれば、何卒、解決方法をご教示願います。
環境
M1 Mac
% make -v GNU Make 3.81 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This program built for i386-apple-darwin11.3.0
他に必要な情報があればコメントください。

回答1件
あなたの回答
tips
プレビュー