기본 콘텐츠로 건너뛰기

MariaDB 요약

MariaDB 요약 설치 macOS MariaDB 설치 brew install mariadb 리눅스 (apt) MariaDB 설치 sudo apt update sudo apt install mariadb-server mariadb-client 보안 설정 mysql_secure_installation 명령 sudo mysql_secure_installation 설정 테이블 직접 변경 루트 계정으로 로그인 mysql -u root mysql DB 사용 use mysql root 계정 비밀번호 생성 UPDATE user SET password=password('비밀번호') WHERE user='root' 유저 권한 갱신 flush privileges (혹은 서버 재시작) 이후 루트 계정 로그인 mysql -u root -p 유저 생성 루트 계정으로 로그인 후(위 보안설정 참고) 유저 생성 CREATE USER '유저이름'@'접속위치' IDENTIFIED BY '비밀번호' 권한 설정 GRANT ALL PRIVILEGES ON DB이름.* TO '유저이름'@'접속위치' 권한 갱신 flush privileges (혹은 서버 재시작) 접속위치 : localhost, 특정 아이피, 호스트이름, %(모든 주소 허용) 그 외 mysql 클라이언트 명령어 현재 유저 확인: SELECT USER() 현재 DB 확인: SELECT DATABASE()
최근 글

Docker on Windows Bash

Docker for Windows 설치 bash에서 유저 홈 디렉토리의 .bashrc파일에 아래 내용을 추가한다. export PATH="$HOME/bin:$HOME/.local/bin:$PATH" export PATH="$PATH:/mnt/c/Program\ Files/Docker/Docker/resources/bin" alias docker=docker.exe alias docker-compose=docker-compose.exe

Docker 요약

Docker 요약 기본 명령어 시작 명령어 및 시작 옵션 (run: pull, create, start) docker run [OPTION] [IMAGE:tag] [COMMAND] [ARGS...] [OPTION] -d detached mode (백그라운드) --name 컨테이너 이름 설정 -it interactive, terminal -p 포트 연결 ( -p HostPort:ContainerPort ) -P EXPOSE된 모든 포트를 연결한다. 이미지 삭제 docker rmi [IMAGE_NAME] 모든 컨테이너 보기 docker ps -a 종료된 모든 컨테이너 삭제 docker rm $(docker ps -a -q) 컨테이너에서 특정 명령 실행 docker exec [OPTION] [CONTAINER_NAME] [COMMAND] 데이터 볼륨 마운트 (예: MySql) docker run -v /my/own/hostDir:/var/lib/mysql mysql:5.7 Dockerfile 이미지 생성을 위한 설정 파일. 이 파일이 있는 디렉토리에서 Docker build 실행 시 이 파일을 기반으로 이미지 빌드. FROM : 기반 이미지 파일 (FROM mariadb/server) USER : 아래 RUN 명령어를 실행할 유저 지정 (USER root) RUN : 터미널 명령 실행. 이미지 빌드 때 실행 (RUN apt-get update) WORKDIR : 터미널에서의 작업 경로 설정 (WORKDIR /etc) ENTRYPOINT : 터미널 명령 실행. 컨테이너 실행 시 실행 (ENTRYPOINT ./npm) CMD : 터미널 명령 실행. 컨테이너 실행 시 실행. 어플 실행, ENTRYPOINT의 파라메터 등에 쓰임 (CMD [“executable”,“param1”,“param2”] - ENTRYPOINT가 설정되어 있으면 [“param1”,“param2”]...

Nano editor shortcut

Command Line Arguments -A Makes the Home key behave more intell­igently (moving to beginning of non-wh­ite­space charac­ters, instead of the beginning of the line, as is default.) -B Backs up edits to a copy of the file in the current directory with the suffix ~. -E Convert typed tabs to spaces. -L Don't add newlines to the ends of files. -N Disable automatic conversion of files from DOS/Mac format. -O Use the blank line below the titlebar as extra editing space. -S Enable smooth scrolling. Text will scroll line-b­y-line, instead of the usual chunk-­by-­chunk behavior. -c Constantly show the cursor position. -w disable wrapping of long lines. -$ Enable softwrap (wraps lines instead of horizontal scrolling.) NOTE: Because  $  is treated as a variable by many execution enviro­nments, it is advisable to flag this option separately from others you may be using, e.g.:  nano -ALNc -$ textfi­le.txt nano [OPTIONS] [[+LIN...

Docker Tutorial (Docker Toolbox)

https://www.docker.com/products/overview 설치파일 다운로드. 내 맥북은 가상화를 지원하지 않는 CPU를 가진 2009년형. 그래서 Docker for Mac 사용불가하여 Docker Toolbox 설치. mkdir yourdockerbuild cd yourdockerbuild touch Dockerfile nano Dockerfile FROM imageNameOnHub:version - 불러올 이미지 RUN *** - 최초 실행할 명령 (설치명령 등. image 안에 설치됨) CMD *** - 이미지가 로딩되면 실행할 명령 docker build -t yourImageName . docker run yourImageName 추가로 hub를 통하지 않고 Image를 이동 하려면 Docker Registry 사용 도커 레지스트리 (Docker Registry) 설치하기 + S3 연동