If you want to disable binary mysql logs, you can. ini to the log-bin line comment out to clear the binary log, in mysql enabled the binary log state, log on to mysql as root after executing one of the following two commands: PURGEMASTERLOGSbefore2020-1-1; PURGEMASTER
If you want to disable binary mysql logs, you can. in ini, comment out the log-bin line to clear binary logs. when mysql enables binary logs, log on to mysql as the root user and execute one of the following two commands: purge master logs before '2017-1-1 '; PURGE MASTER
To disable binary mysql logs, comment out the log-bin line in my. ini.
To clear binary logs, log on to mysql as the root user and execute one of the following two commands when mysql enables binary logs:
Purge master logs before '2017-1-1 '; clears binary LOGS before a specified date
Purge master logs to 'mysql-bin.010 '; clears binary LOGS before the specified file number
Note that if you delete the mysql-bin.xxx file directly without running the command, the list of log files is still logged in the mysql-bin.index so that logs are cleared later, mysql logs cannot be cleared because the log files in the list cannot be found.
You can use mysqlbinlog.exe in the binlog to view the mysql binary log.
C: \> mysqlbinlog mysql-bin.000001
If the character set is set in my. ini, the following errors may occur:
Mysqlbinlog: unknown variable 'default-character-set = gbk'
Solve the problem with the -- no-defaults Parameter
C: \> mysqlbinlog -- no-defaults mysql-bin.000001
To clear *. err logs, stop the mysql database, cut or delete the file, and restart mysql to generate a new one.
2. Clear all content in a mysql table
Delete from table name;
Truncate table name;
The delete statement without the where parameter can delete all content in the mysql table. You can also use the truncate table to clear all content in the mysql table. In terms of efficiency, truncate is faster than delete, but after truncate is deleted, mysql logs are not recorded and data cannot be recovered.
The delete operation is like deleting all records in the mysql table one by one, and truncate is equivalent to retaining the structure of the mysql table and re-creating the table. All statuses are equivalent to new tables.