Guest User

Untitled

a guest
Jul 2nd, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. //run a c docker container of aline that declares using port 3306:
  2. docker run -it -p 3306:3306/tcp <docker-alpine-image-id> /bin/sh
  3. //inside the docker container do the following:
  4. apk update
  5. apk add mysql mysql-client
  6.  
  7. DB_DATA_PATH="/var/lib/mysql"
  8. DB_ROOT_PASS="mariadb_root_password"
  9. DB_USER="mariadb_user"
  10. DB_PASS="mariadb_user_password"
  11. MAX_ALLOWED_PACKET="200M"
  12.  
  13. mysql_install_db --user=mysql --datadir=${DB_DATA_PATH}
  14.  
  15. /usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf --user=mysql
  16.  
  17. //to allow connecting to the DB from other hsosts, do the following:
  18. mysql
  19. //once inside the mysql client, run the following queries
  20. CREATE USER 'aiakos'@'localhost';
  21. GRANT ALL PRIVILEGES ON *.* TO 'aiakos'@'localhost' WITH GRANT OPTION;
  22. CREATE USER 'aiakos'@'%' ;
  23. GRANT ALL PRIVILEGES ON *.* TO 'aiakos'@'%' WITH GRANT OPTION;
  24. FLUSH PRIVILEGES;
  25. exit
  26. //edit /etc/my.cnf file
  27. //in section [mysqld] add the following:
  28. bind-address = <ip address / host name that is accessible from outside the DB host>
  29. //restart DB so change will take affect
  30.  
  31. //if running aiakos server from the docker compose, do the following to use our alpine mariaDB instead of the native one:
  32. //edit docker-compose.yml
  33. //remove the mysql service definition
  34. //in all other sections:
  35. //remove the 'depends on' section
  36. //modify the DB URL to be
  37. DATABASE_URL=mysql://aiakos@<the ip or name the DB container is exposing>/accounts
Add Comment
Please, Sign In to add comment