[mysql@oel1 ~]$ mysql_config_editor set --login-path=fastlogin --user=root --host=localhost --password --socket=/u02/mysql/mysqld_mst.sock
Enter password:
配置完成之后,会在当前路径下生成一个隐藏文件.mylogin.cnf
[mysql@oel1 ~]$ ll -la .mylogin*
-rw------- 1 mysql dba 480 May 17 22:10 .mylogin.cnf
[mysql@oel1 ~]$
大功告成,这个时候直接登录即可。
[mysql@oel1 ~]$ mysql --login-path=fastlogin
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
Copyright (c) 2000, 2015, 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.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>