CATCHV Blog

mysqladmin 본문

Database/MySQL

mysqladmin

catchv 2022. 11. 17. 16:47
반응형

1. mysqladmin

mysqladmin은 mysql에서 관리자로 사용하는 명령어들을 실행시켜주는 프로그램입니다. 제가 가장 많이 사용하는 경우는 FLUSH LOGS; 명령으로 error.log 파일을 flush하고 log를 백업하는 스크립트에서 사용하였습니다.

 

1) 사용방법

$ mysqladmin -uroot -p [명령어]

2) 명령어 정리

create databasename   - database를 생성한다.
debug                 - 사용 안해 봄.
drop databasename     - 데이터베이스를 삭제한다.
extended-status       - SHOW GLOBAL STATUS; 명령어와 동일한 서버의 상태 값을 보여준다.
flush-hosts           - TRUNCATE TABLE performance_schema.host_cache; 명령어와 동일한 DNS 관련 정보가 켜져 있으면 host정보가 쌓이는데 해당 정보를 삭제한다.(performance_schema.host_cache)
flush-logs            - FLUSH LOGS; 
flush-status          - FLUSH STATUS; 
flush-tables          - FLUSH TABLES;   
flush-threads         - 대응 SQL문이 없음. command_type에 Refresh의 타입의 명령어가 날라오나 명령어는 존재하지 않음.
flush-privileges      - FLUSH PRIVILEGES; 
kill id,id,...        - KILL pid; 세션을 KILL 처리 한다.
password [new-password]   - 패스워드를 변경합니다.(해당 명령어는 shell history등에 남을 수 있으므로 해당 내용 명령어는 사용을 하지 않도록 합니다.)
ping                  - 서버가 살아 있는지 확인한다. 

mysqladmin -uroot -p ping
mysqld is alive

processlist           - information_schema.processlists 의 정보를 출력합니다. Show list of active threads in server
reload                - flush privileges; Reload grant tables
refresh               - 대응 SQL문이 없음. command_type에 Refresh의 타입의 명령어가 날라오나 명령어는 존재하지 않음. Flush all tables and close and open logfiles
shutdown              - 서버를 종료합니다.(systemctl stop mysqld)  Take server down
status                - 대응 SQL문이 없음. command_type에 Statistics의 타입의 명령어가 날라오나 명령어는 존재하지 않음.  

mysqladmin -uroot -p status;
Uptime: 5052  Threads: 3  Questions: 316  Slow queries: 0  Opens: 427  Flush tables: 6  Open tables: 3  Queries per second avg: 0.062

start-replica         - 복제를 시작한다. 
start-slave           - start-replica와 동일(추후 삭제 예정)
stop-replica          - 복제를 중지한다. 
stop-slave            - stop-replica와 동일(추후 삭제 예정)
variables             - SHOW GLOBAL VARIABLES; 시스템 환경변수의 설정값을 보여준다.
version               - 버전 정보 및 상태정보를 보여준다.

mysqladmin  Ver 8.0.31 for Linux on aarch64 (MySQL Community Server - GPL)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Server version          8.0.31
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 2 hours 37 min 51 sec

Threads: 3  Questions: 321  Slow queries: 0  Opens: 429  Flush tables: 6  Open tables: 5  Queries per second avg: 0.033

 

반응형

'Database > MySQL' 카테고리의 다른 글

MySQL Shell (1) - 설치  (0) 2022.11.21
mysqlcheck  (0) 2022.11.18
mysql_tzinfo_to_sql  (0) 2022.11.17
mysql_secure_installation  (0) 2022.11.17
mysql 8.x - mysql_config_editor  (0) 2022.11.16
Comments