Etc/Database

MySQL Login path 설정하기

곤프 2021. 8. 16. 16:07

mysql 5.6부터 보안 문제로 인해 패스워드를 커맨드라인에서 직접 입력하기 어려워졌습니다. 대신에 login path라는 것을 사용하면 되는데요. 커맨드를 자주 잊어버리네요. “Warning: using a password on the command line interface can be insecure. “ 이런 메세지가 출력될 때 사용하면 되겠네요. 간단한 사용법을 정리해 봅니다.

1. login path help

$ mysql_config_editor --help mysql_config_editor Ver 1.0 Distrib 5.7.18, for linux-glibc2.5 on x86_64 Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. MySQL Configuration Utility. Usage: mysql_config_editor [program options] [command [command options]] -#, --debug[=#] This is a non-debug version. Catch this and exit. -?, --help Display this help and exit. -v, --verbose Write more information. -V, --version Output version information and exit. Variables (--variable-name=value) and boolean options {FALSE|TRUE} Value (after reading options) --------------------------------- ---------------------------------------- verbose FALSE Where command can be any one of the following : set [command options] Sets user name/password/host name/socket/port for a given login path (section). remove [command options] Remove a login path from the login file. print [command options] Print all the options for a specified login path. reset [command options] Deletes the contents of the login file. help Display this usage/help information.

흠.. 간단하네요..

2. generate login path

$ mysql_config_editor set --login-path=설정이름 --host=주소 --user=아이디 --port=포트 --password Enter password: *****

3. print login path

$ mysql_config_editor print --login-path=설정이름