tables=$(mysql -h${host_name} -u${user_name} -p${password}-e"SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA='${db_name}' AND ENGINE='MyISAM';")
for table in${tables} do if [ ${table} != 'TABLE_NAME' ]; then# 排除标题 echo${table} mysql -h${host_name} -u${user_name} -p${password}-e"ALTER TABLE ${db_name}.${table} ENGINE='InnoDB';" fi done
If you hit this problem and don’t want to understand what’s going on, don’t reopen this ticket, just do this:
RECOMMENDED SOLUTION: close the connection with from django.db import connection; connection.close() when you know that your program is going to be idle for a long time.
CRAPPY SOLUTION: increase wait_timeout so it’s longer than the maximum idle time of your program.
In this context, idle time is the time between two successive database queries.