![[MySQL] (Windows) 스크립트 실행 시 비밀번호 경고 처리 (Warning:Using a password on the command line interface can be insecure) [MySQL] (Windows) 스크립트 실행 시 비밀번호 경고 처리 (Warning:Using a password on the command line interface can be insecure)](http://t1.daumcdn.net/tistory_admin/static/images/no-image-v1.png)
에러 상황
MySQL의 DB 백업을 하는 도중 batch 파일을 만들어서 실행시켰을 때 아래와 같은 경고 메시지가 출력됐다.
에러 코드
Warning :Using a password on the command line interface can be insecure
해결 방법
MySQL 5.6 이후 버전에서 쉘 스크립트를 실행하거나 mysqldump를 사용하는 경우 발생하는 오류이다.
여러 블로그를 찾아보니 크리티컬한 문제는 없어서 무시해도 된다고는 하지만 그래도 오류는 오류이니 해결하도록 한다.
먼저 명령 프롬포트를 열어 MySQL 서버가 설치된 폴더안의 bin폴더로 이동한다.
> cd D:\\MySQL 설치폴더\bin
다음으로 mysql config 등록을 위해 다음의 명령어를 입력해준다.
mysql_config_editor set --login-path=root --host=localhost --user=root --port=3306 --password
- --login-path : 로그인 정보를 담고 있는 일종의 접속명을 의미한다.
- --host : 접속할 DB의 IP 또는 도메인 주소
- --user : DB 계정
- --port : 기본 포트(3306)가 아닌 경우 필수로 입력해야한다.
- --password : 별도의 입력 없이 추후 나오는 창에 입력하면 된다.
다음으로 DB 비밀번호를 입력한다.
Enter Password : [비밀번호]
비밀번호까지 입력했으면 config에 DB정보가 등록이 완료됐다.
정상적으로 등록됐는지 확인하고 싶다면 다음의 명령어를 입력한다.
• 등록된 전체 login-path 정보 확인
> mysql_config_editor print --all
• 원하는 login-path의 정보 확인
> mysql_config_editor print -G login-path명
config의 정보 삭제를 원하는 경우 다음의 명령어를 입력한다.
• 등록된 정보 삭제
> mysql_config_editor remove --login-path=login-path명
이제 쉘 스크립트나 mysqldump에서 -u [아이디] -p [비밀번호] 대신 위에서 작성한 --login-path=[접속명]을 입력하면 된다.
참고 사이트
https://abruption.github.io/posts/MySQL-password-insecure/
MySQL 쉘스크립트 작성 시 비밀번호 경고 처리하기 (Warning :Using a password on the command line interface can b
MySQL 5.6 이후 버전에서 쉘 스크립트를 실행하거나 mysqldump를 사용하면 Warning: Using a password on the command line interface can be insecure 오류가 발생한다. 검색해보니 무시해도 상관이 없다고 하지만, 뭔가...
abruption.github.io
'🛢️DataBase > 오류해결' 카테고리의 다른 글
[MSSQL] 데이터베이스 '복구 보류 중' 오류 해결 (0) | 2024.03.12 |
---|---|
[MSSQL] Microsoft SQL Server, 오류: 18456 해결 (0) | 2024.01.19 |
댓글