本文主要是介绍免密登录mysql,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
有时候有人想偷懒,直接免密登录mysql。可以按照以下方法操作
1.编辑配置文件
vim /root/.my.cnf
[client]
user=root
password=123
2.修改权限
chmod 400 ~/.my.cnf
3.登录查看
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.20-log 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.www.wityx.com/database
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
root@localhost :(none)12:09:35>
可以了,现在能免密登录了!
这篇关于免密登录mysql的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!