Shell脚本中执行sql语句操作mysql的5种方法

源:http://www.jb51.net/article/56944.htm
评:
shell脚本中MySQL提示符下调用SQL
[root@SZDB ~]# more shell_call_sql2.sh 
#!/bin/bash 
mysql -uroot -p123456 <<EOF 
source /root/temp.sql; 
select current_date(); 
delete from tempdb.tb_tmp where id=3; 
select * from tempdb.tb_tmp where id=2; 
EOF 
exit; 

模版:

#!/bin/bash 
mysql -uroot -p123456 <<EOF

。。。。。

EOF 
exit; 

猜你喜欢

转载自mauersu.iteye.com/blog/2408480
今日推荐