WEBBOOK CHAPTER

웹서비스 개발 도구 상자: 21장. DB CLI를 GUI보다 먼저 익힌다

21장. DB CLI를 GUI보다 먼저 익힌다

psql, mysql, mongosh는 connection target과 transaction을 명시하고 script로 반복하기 좋다. GUI client는 schema 탐색과 plan 시각화에 유용하지만 production write를 쉽게 만들 수 있다.


psql "$READ_ONLY_DATABASE_URL" -v ON_ERROR_STOP=1 
  -c 'select current_database(), current_user, now();'

URL을 history나 process list에 남기지 않는 credential 방식을 쓴다. production은 read-only account, statement timeout, transaction read only를 기본으로 한다. 결과 export의 개인정보를 최소화한다.