作者:gaoxuxinyue23 | 来源:互联网 | 2023-02-12 20:53
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!~(-3P{x^ mz\+1$$> ^<^sE' 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>