时间:2021-07-01 10:21:17 帮助过:27人阅读
for i in ${MYSQL_LOGIN} -N -e "select user,host from mysql.user;"| awk ‘{print "‘\‘‘" $1 "‘\‘‘" "@" "‘\‘‘" $2 "‘\‘‘"}‘
; do ${MYSQL_LOGIN} -N -e " show grants for $i;"; done
#里面涉及了awk print单引号和双引号的小技巧
awk ‘{ print "‘\t‘"}‘ #单引号
awk ‘{ print "\""}‘ #双引号
MySQL导出所有账号的GRANTS语句
标签:done user base ase $2 mys code soc word