centos7 mysql5.7 免密码登陆

1:进入root下
su
密码:
2:在root下编辑
mysql_config_editor set --login-path=client --host=localhost --user=root --password
Enter password:
3:输入
pwd
在/root下生 .mylogin.cnf乱码文件
[nanfengpo@master ~]$ su
密码:
[root@master nanfengpo]# mysql_config_editor set --login-path=client --host=localhost --user=root --password
Enter password: 
[root@master nanfengpo]# pwd
/home/nanfengpo
4:查看该文件
[root@master ~]# cat .mylogin.cnf

           #��8x!~��(��-��3�P��{�x�^� m�z�\��+1�$�$>� ^�<��^s�E'� 7�<
���u��љC먚-X��װ���>�@Lg[root@master ~]# 
5:直接输入mysql --login-path=client进行登陆mysql
[root@master nanfengpo]# mysql --login-path=client 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.7.19 MySQL Community Server (GPL)


Copyright (c) 2000, 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.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


mysql> 

猜你喜欢

转载自blog.csdn.net/alicia_n/article/details/78187702
今日推荐