linux下,每次用mysql连接连接服务器,常常用如下方式:
[root@localhost ~]# mysql -hlocalhost -uroot -p11111
每次都输入用户名,密码,多折腾人啊,有没有更方便的方式?
我们只需要简单地配置下my.cnf的client节即可,把用户名,密码信息都放到client节中。配置示例如下:
# The following options will be passed to all MySQL clients 18 [client] 19 host = "localhost" 20 password = "11111" 21 user = "root" 22 port = 3306 23 socket = /tmp/mysql.sock修改my.cnf之后,不需要重启服务器,直接运行mysql,即可方便地连接到指定服务器。
转载于:https://blog.51cto.com/fuwenchao/1347109