linux-tutorial/codes/shell/示例脚本/mysql/连接数据库并发送命令.sh
2019-05-10 11:17:57 +08:00

14 lines
202 B
Bash

#!/bin/bash
#连接数据库
mysql=`which mysql
`
#发送单个命令
$mysql emwjs -u test -e "show databases;"
#发送多个命令
$mysql emwjs -u test <<EOF
show tables;
select * from em_admin;
EOF