Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //run a c docker container of aline that declares using port 3306:
- docker run -it -p 3306:3306/tcp <docker-alpine-image-id> /bin/sh
- //inside the docker container do the following:
- apk update
- apk add mysql mysql-client
- DB_DATA_PATH="/var/lib/mysql"
- DB_ROOT_PASS="mariadb_root_password"
- DB_USER="mariadb_user"
- DB_PASS="mariadb_user_password"
- MAX_ALLOWED_PACKET="200M"
- mysql_install_db --user=mysql --datadir=${DB_DATA_PATH}
- /usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf --user=mysql
- //to allow connecting to the DB from other hsosts, do the following:
- mysql
- //once inside the mysql client, run the following queries
- CREATE USER 'aiakos'@'localhost';
- GRANT ALL PRIVILEGES ON *.* TO 'aiakos'@'localhost' WITH GRANT OPTION;
- CREATE USER 'aiakos'@'%' ;
- GRANT ALL PRIVILEGES ON *.* TO 'aiakos'@'%' WITH GRANT OPTION;
- FLUSH PRIVILEGES;
- exit
- //edit /etc/my.cnf file
- //in section [mysqld] add the following:
- bind-address = <ip address / host name that is accessible from outside the DB host>
- //restart DB so change will take affect
- //if running aiakos server from the docker compose, do the following to use our alpine mariaDB instead of the native one:
- //edit docker-compose.yml
- //remove the mysql service definition
- //in all other sections:
- //remove the 'depends on' section
- //modify the DB URL to be
- DATABASE_URL=mysql://aiakos@<the ip or name the DB container is exposing>/accounts
Add Comment
Please, Sign In to add comment