mysql本机怎么登陆 mysql怎么用cmd登陆( 二 )


vi ~/.my.cnf
将下边的内容放入上方的文件当中
[client]
host='localhost'
#登录的用户名
user='system'
#用户的密码
password='guan'
2.编辑完成的文件如下图:
[root@master2 ~]# cat ~/.my.cnf
[client]
host='localhost'
#登录的用户名
user='system'
#用户的密码
password='guan'
3.测试
保存后 , 再登录mysql的时候,只需要输入mysql们不需要加后面的用户名和密码
[root@master2 ~]# mysql#后边没有跟用户名和密码
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.14-log MySQL Community Server (GPL)
Copyright (c) 2000, 2013, 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##可以看到我们已经登陆成功
【mysql本机怎么登陆 mysql怎么用cmd登陆】关于mysql本机怎么登陆和mysql怎么用cmd登陆的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站 。

推荐阅读