編輯你的mysql.cnf添加如下信息



[client] 
#password   = your_password 
password    = your passwd 
port        = 3306 
socket      = /tmp/mysql.sock

創建mysql去重腳本,另存爲file.sql文件



use dataname;
create table tmp_table as select min(log_ID) from a_post group by a_Title;
delete from a_post where log_ID not in (select * from tmp_table);
DROP TABLE tmp_table;

添加定時任務



0 */3 * * *  mysql -uroot  -e "source /路徑/file.sql"

搞定~

标签: 方法, mysql,

添加新评论