mysql login-path 로 로그인하기
mysql 접속시 유저/패스워드 입력안하고 로긴하는 방법을 알아보자
lee@mysql-m:~$
lee@mysql-m:~$ mysql_config_editor print --all
lee@mysql-m:~$
lee@mysql-m:~$ mysql_config_editor set --login-path=rootconn --host=localhost --user=root --password
Enter password:
lee@mysql-m:~$
lee@mysql-m:~$
lee@mysql-m:~$ ls -al
합계 48
drwxr-xr-x 6 lee lee 4096 1월 16 21:43 .
drwxr-xr-x 3 root root 4096 1월 13 01:00 ..
-rw------- 1 lee lee 106 1월 14 19:46 .Xauthority
-rw------- 1 lee lee 1416 1월 16 17:57 .bash_history
-rw-r--r-- 1 lee lee 220 1월 13 01:00 .bash_logout
-rw-r--r-- 1 lee lee 3771 1월 13 01:00 .bashrc
drwx------ 11 lee lee 4096 1월 13 01:29 .cache
drwx------ 11 lee lee 4096 1월 14 18:21 .config
drwx------ 3 lee lee 4096 1월 13 01:14 .gnupg
drwxr-xr-x 3 lee lee 4096 1월 13 01:14 .local
-rw------- 1 lee lee 136 1월 16 21:44 .mylogin.cnf
lee@mysql-m:~$ mysql_config_editor print --all
[rootconn]
user = "root"
password = *****
host = "localhost"
lee@mysql-m:~$
mysql_config_editor 명령으로 credential 을 생성하면 유저 홈 디렉토리에 ".mylogin.cnf" 파일이 생성이 된다.
이후부터는 mysql 로긴시 패스워드를 입력할 필요없이 login-path 옵션을 붙여주면 된다.