shell/mysql数据库/连接数据库并发送命令.sh

14 lines
202 B
Bash
Raw Normal View History

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