baby steps on mariadb configuration

This commit is contained in:
hugo gogo
2022-09-05 11:41:06 +02:00
parent 97e92321f1
commit c2ecbf5e11
3 changed files with 52 additions and 3 deletions

View File

@@ -67,6 +67,7 @@
- [go inside docker to debug it](https://docs.docker.com/engine/reference/commandline/container_exec/)
- `docker exec -ti <container-name> bash` to run bash inside a running container
- [docker CMD vs ENTRYPOINT](https://phoenixnap.com/kb/docker-cmd-vs-entrypoint)
- [use env variable with compose](https://docs.docker.com/compose/environment-variables/)
###### docker pid 1
- nginx by default will create some child process (a master and some workers), then it quits (doc ?)
@@ -118,6 +119,9 @@
- bind mounts are normal files anywhere on the computer, that docker container can access with absolut path and modify. They can also be modified without docker, since they are juste files
- volumes are only modifiable by docker, they don't need an absolut path, and they are not dependent of host architecture
###### psswd in dockerfile :
- [SO securing passwords in dockerfiles](https://stackoverflow.com/questions/22651647/docker-and-securing-passwords)
#### nginx
- [nginx begginer guide](https://hub.docker.com/_/nginx/)
- [nginx all directives for conf file](https://nginx.org/en/docs/dirindex.html)
@@ -144,8 +148,41 @@
- "server" runs in the background and listen for inputs
- "client" interpret the commands to communicate with "server"
- sudo apt install mariadb-client mariadb-server
- [ERROR 1698 (28000): Access denied for user 'root'@'localhost'](https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost)
- [wiki ubuntu mariadb](https://doc.ubuntu-fr.org/mariadb)
- [list of directives](https://mariadb.com/kb/en/sql-statements/)
- [ERROR 1698 (28000): Access denied for user 'root'@'localhost'](https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost)
- [ERROR 1698 (28000): Access denied for user 'root'@'localhost' 2](https://askubuntu.com/questions/763336/cannot-enter-phpmyadmin-as-root-mysql-5-7#answer-1003892)
- [meaning of % SO](https://stackoverflow.com/questions/12931991/mysql-what-does-stand-for-in-host-column-and-how-to-change-users-password)
- [meaning of % doc](https://doc.ubuntu-fr.org/mysql#connexions_entrantes)
- `%` means all entrant connections, while `localhost` means only localhost connections
- [mysql commande line](https://mariadb.com/kb/en/mysql-command-line-client/)
- [use mysql in script](https://stackoverflow.com/questions/59608632/mariadb-create-database-and-execute-sql-script-without-character-from-the)
###### mariadb basic commands :
- create user :
```
# mysql -u root
use mysql;
CREATE USER 'some_user'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'some_user'@'%' WITH GRANT OPTION;
FLUSH PRIVILEGES;
```
- show users :
```
SELECT User, Host, plugin FROM mysql.user;
```
- delete user :
```
DROP USER <name>;
```
- show databases :
```
SHOW DATABASES;
```
- delete database :
```
DROP DATABASE <name>;
```
#### php-fpm
- [](https://en.wikipedia.org/wiki/FastCGI)

View File

@@ -10,8 +10,8 @@ version: "3.8"
services:
# ---------------------------------
test:
build:
context: ./requirements/test
dockerfile: Dockerfile
@@ -19,8 +19,8 @@ services:
container_name: mytest
# ---------------------------------
nginx:
# restart: on-failure
ports:
- "80:80"
@@ -31,5 +31,14 @@ services:
image: nginx
container_name: mynginx
# ---------------------------------
mariadb:
# restart: on-failure
build:
context: ./requirements/mariadb
dockerfile: Dockerfile
image: mariadb
container_name: mymariadb
# ---------------------------------

View File

@@ -2,3 +2,6 @@ FROM debian:buster
RUN apt update && apt install -y mariadb-client mariadb-server
RUN mariadb --execute="create database db_hugo_test; create user 'u_hugo_test'@'localhost' identified by 'hello'; grant all privileges on *.* to 'u_hugo_test'@'localhost' with grant option;"
CMD [ "mysqld" ]