Home > Database > Mysql Tutorial > body text

将mysql执行结果依照固定格式写入文件

WBOY
Release: 2016-06-07 16:25:09
Original
1172 people have browsed it

将mysql执行结果按照固定格式写入文件 该脚本是先删除已经存在的文件,然后后台执行SQL语句将其执行结果以一定的式写入文件 #!/bin/bashif [ -f /var/lib/mysql/hell.txt ]; thenrm -f /var/lib/mysql/hell.txtecho delete /var/lib/mysql/hell.txt hell.txtf

将mysql执行结果按照固定格式写入文件

该脚本是先删除已经存在的文件,然后后台执行SQL语句将其执行结果以一定的格式写入文件


 

#!/bin/bash
if [ -f "/var/lib/mysql/hell.txt" ]; then
rm -f /var/lib/mysql/hell.txt
echo "delete /var/lib/mysql/hell.txt" >> hell.txt
fi
mysql -uroot -plab 
<p><br>
 </p>



Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template