mysql别名

来源:互联网 发布:新淘宝网 编辑:程序博客网 时间:2024/05/01 18:03
mysql别名
[root@orcl~]# alias mysql="/usr/local/mysql/bin/mysql -uroot --password="" -S /usr/local/mysql/mysql.sock";
[root@orcl~]# mysql
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 389055
Server version: 5.6.12-log Source distribution


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> 
alias mysql="/usr/local/mysql/bin/mysql -uroot --password="" -S /usr/local/mysql/mysql.sock";

为了永久生效,需要在ssh用户/root/.bash_profile加载,因为我这边都是root帐号登录的
[root@orcl~]# more /root/.bash_profile 
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin
alias mysql="/usr/local/mysql/bin/mysql -uroot --password="" -S /usr/local/mysql/mysql.sock";
export PATH
[root@orcl~]# 
1 0