clean_mysql.sh 581 B

123456789101112131415161718192021
  1. #! /bin/bash
  2. . /opt/app/bi-app/energy/history/config.sh
  3. url=$MYSQL_URL
  4. username=$MYSQL_USER
  5. password=$MYSQL_PASSWORD
  6. database=saga_dev
  7. del_energy_15_min_history="truncate table energy_15_min_history;"
  8. del_energy_5_min_history="truncate table energy_5_min_history;"
  9. ## 历史数据一次性导入后,需要删除 mysql 中的冗余数据
  10. clean_energy_15(){
  11. mysql -h${url} -P3306 -u${username} -p${password} ${database} -e "${del_energy_15_min_history}"
  12. }
  13. clean_energy_5(){
  14. mysql -h${url} -P3306 -u${username} -p${password} ${database} -e "${del_energy_5_min_history}"
  15. }