19,613
社区成员
发帖
与我相关
我的任务
分享
[root@xuexi ~]# c=`mysql -uroot -pp@ssword1! test <<eof | tail -n 2
select distinct name from Student limit 2;
eof`
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@xuexi ~]# echo $c
chenyi huanger
[root@xuexi ~]# d=`mysql -uroot -pp@ssword1! test 2>/dev/null <<eof | tail -n 2
select distinct name from Student limit 2;
eof`
[root@xuexi ~]# echo $d
chenyi huanger
user=root
pass=root
depts=`mysql -u $USER -p$PASS students 2>/dev/null <<EOF | tail -n +2
SELECT DISTINCT dept FROM students;
EOF`