0
点赞
收藏
分享

微信扫一扫

shell中执行sql命令并返回结果

金刚豆 2024-09-04 阅读 22

#!/bin/bash

password=“xxxxxxx”


kubectl -n xxxxns exec -it mysql-0-0 -- mysql -h10.1.5.1 -P3306 -u dbuser -Deip -p$password  -e "select * from iptbs" | while read line

do

   echo "Row: $line"

done


举报

相关推荐

0 条评论