from MySQLdb import *
c = connect(host = "localhost", user="계정아이디", passwd="비밀번호", db="데이터베이스이름")
cursor = c.cursor()
cursor.execute('select post_id from phpbb_posts_text where post_text like "%moraebat%";')
post_id_list = [cols[0] for cols in cursor.fetchall()]
for post_id in post_id_list:
cursor.execute("select topic_id, forum_id from phpbb_posts where post_id = %d;" % (post_id))
topic_id, forum_id = cursor.fetchall()[0]
print post_id, topic_id, forum_id
cursor.execute("delete from phpbb_posts_text where post_id = %d limit 1;" % (post_id))
cursor.execute("delete from phpbb_posts where post_id = %d limit 1;" % (post_id))
cursor.execute("delete from phpbb_topics where topic_id = %d limit 1;" % (topic_id))

(
0)

(
0)
http://imp17.com/tc/myevan/trackback/229