2

终端中快捷登录 MySQL

 3 years ago
source link: https://mednoter.com/mysql-shortcuts.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

终端中快捷登录 MySQL

以前在终端中登录MySQL,需要输入这么长的一堆命令。

> mysql -u root -p
> please enter your password
> ******

在用户的根目录下添加了一个文件后,我只需要输入mysql,就可自动登录了。

> mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 100
Server version: 5.6.10 Source distribution

mysql> 

怎么实现?

  1. 创建~/.my.cnf

  2. 将权限修改为 600

  3. [mysql]
    user=root
    password=pass
    host=localhost

    [mysqldump]
    user=root
    password=pass
    host=localhost

    [mysqldiff]
    user=root
    password=pass
    host=localhost

参考资料:

  1. StackOverflow: MySQL Utilities
吕小荣
10 January 2014

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK