MySQL delete more records under the SSC source build will appear the following error: Enterprise e: 217 1793 408
caused By:com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:No operations allowed after Connection closed.
So the data in the table needs to be deleted in batches, with the following script:
#!/bin/bash
Db_user= "Root"
db_pass= "PW"
Db_host= "10.228.221.25"
Db_name= "TJXX"
Port= "3306"
echo "Sql start" >>/home/xxf/log.txt
times=date "+%Y-%m-%d"
echo "${times}" >>/home/xxf/log.txt
Delete_sql= "Delete from Region_stastics_history where time < ' ${times} ' order by ID limit 1000;"
#mysql-u$db_user-p$db_pass-h$db_host-p${port} $DB _name-e "${delete_sql}"
Count=0
While [$count-le];d o
echo $count >>/home/xxf/log.txt
Mysql-u$db_user-p$db_pass-h$db_host-p${port} $DB _name-e "${delete_sql}"
count=$ ((count + 1))
Done
echo "Sql End" >>/home/xxf/log.txt
Use shell scripts to remove MySQL records under Linux SSC source build