This morning, I found that the browser request was pending, and the result was returned after a long time

Lock wait timeout exceeded; try restarting transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException: Lock wait timeout exceeded; try restarting transaction"
Copy the code

Connection refused: connect Connection refused: connect Connection refused: connect

Below record the request log file trilogy (of course, under the premise of normal connection to the database), otherwise can only ask the operation and maintenance students to manually delete it

The first step

show binary logs;

View all log files

The second step

show master status;

View log files in use

The third step

purge binary logs to 'mysql-bin.000021'

Delete all log files except those in use

Famous, of courseMysqlThere must be an automatic deletion function

1. Find the mysql configuration file and add or update parameters

expire_logs_days=10
Copy the code

2. You can also run commands to set it temporarily, but the database will become invalid after being restarted

show variables like '%logs%';
set global expire_logs_days = 10;
Copy the code

Ten is ten days

View the contents of binlog logs

SHOW BINLOG EVENTS IN 'mysql-bin.000002'
Copy the code