사용자 도구

사이트 도구


database:mysql:shell

문서의 이전 판입니다!


mysql-shell

install

snapcraft

# snap 설치시에 파일 백업 경로등이 올바로 잡히지 않음.
# 경로를 /tmp 로 지정하면 /tmp/snap-private-tmp 로 잡히는 문제가 있음.
sudo snap install mysql-shell

apt repo

sudo dpkg -i mysql-apt-config_<version>_all.deb
sudo apt-get update
 
# update repository configuration 필요할 경우에만
sudo apt-get install mysql-apt-config
sudo apt-get install mysql-shell

실행

  • mysqlsh 명령으로 실행

기본 명령

  • 기본 명령들이 \ (역슬래시)로 시작한다는 점 주의
  • 접속
\connect <hostname>:<port>

dump & load (backup / restore)

Table 단위 dump / load

util.dump_tables('<schema-name>', ['table1', 'table2'], '/저장/경로/dir');
  • 이는 python 코드를 호출하는 것이기 때문에 각 파라미터를 변수에 넣어두고 변수로 지정해줘도 된다.

참조

database/mysql/shell.1684831206.txt.gz · 마지막으로 수정됨: 2023/05/23 17:40 저자 kwon37xi