shell脚本执行.sql文件 切换用户执行shell脚本

shell脚本执行.sql文件:

mysql -uxxx -pxxx db名 < xxx/xxx.sql

切换用书执行shell脚本

执行单行脚本:

   su - 用户 -c 'xxx'

执行.sh文件

  su - 用户 -s /bin/bash xxx.sh

猜你喜欢

转载自blog.csdn.net/zhaolq1024/article/details/82220276