shell脚本执行.sql文件:
mysql -uxxx -pxxx db名 < xxx/xxx.sql
切换用书执行shell脚本
执行单行脚本:
su - 用户 -c 'xxx'
执行.sh文件
su - 用户 -s /bin/bash xxx.sh
shell脚本执行.sql文件:
mysql -uxxx -pxxx db名 < xxx/xxx.sql
切换用书执行shell脚本
执行单行脚本:
su - 用户 -c 'xxx'
执行.sh文件
su - 用户 -s /bin/bash xxx.sh