kotto5 / Inception

Construct Wordpress service with three container (nginx, wordpress, mariadb)
0 stars 0 forks source link

mariadb のsetup #16

Closed kotto5 closed 10 months ago

kotto5 commented 10 months ago
kotto5 commented 10 months ago

show databases user db_name show tables

kotto5 commented 10 months ago

login user はwordpress 作る時にはまだいらない気がする user 、database は作っておく必要がありそう

kotto5 commented 10 months ago

https://wiki.alpinelinux.org/wiki/MariaDB これはapline公式が出している alpine への mariadb のinstall 方法 良さげ!

kotto5 commented 10 months ago

Initialization

The version of MariaDB in the Alpine repositories behave like the MySQL tarball. No graphical tools are included. The datadir located at /var/lib/mysql must be owned by the mysql user and group. The location of the datadir can be changed by editing the mariadb service file in /etc/init.d. The new location will also need to be set by adding datadir= in the [mysqld] section in a mariadb configuration file.

セットアップはmysql とほぼ同じ。data は /var/lib/mysql に作られるけど /etc/init.d のservice file を書き換えることで変更できるよ!

Normal initialization of mariadb can be done as follows: Initialize the main mysql database, and the data dir as standardized to /var/lib/mysql by running rc-service mariadb setup Start the main service. At this point there will be no root password set. rc-service mariadb start Secure the database by running mysql_secure_installation Setup permissions for managing others users and databases

kotto5 commented 10 months ago
/ # service mariadb start
 * WARNING: mariadb is already starting
/ # service mariadb status
 * status: stopped

https://mariadb.com/kb/en/what-to-do-if-mariadb-doesnt-start/

kotto5 commented 10 months ago
chown nginx /var/lib/mysql
kotto5 commented 10 months ago

もしかしてvolume 関係ある???/

kotto5 commented 10 months ago
354de67b72e5:/usr# mariadb
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)

気になるエラー server をまだ立てていないから問題ないか?

rc-service mariadb start が失敗するのと mysql_secure_installation これの途中で同じエラーが出ている

kotto5 commented 10 months ago

公式のDockerfile が、/var/lib/mysql をdockerfile 内で削除し直している 関係あるかもしれないのでやってみようとするが、device or resource busy と言われ失敗 https://qiita.com/baeyear/items/9530b1f83c83ac888875 このエラーは、そのリソースを複数のプロセスが操作している時に起こるらしい。 そして、今回の場合、docker engine と多分競合している? 課題要件では mount を使うことになっているが、現状は volume を使っている volume や mount には network と同様に driver という、volume の設定を加える項目がある これをいじることで解決できるかもしれない

Dockerのストレージドライバを理解する Docker Volume (特に volumeタイプ) のわかりづらいところを説明してみる docker-compose volumes定義とは?

色々ある

https://docs.docker.com/compose/compose-file/06-networks/#driver_opts https://matsuand.github.io/docs.docker.jp.onthefly/storage/volumes/

読みきれない