These mysql-bin.0000* files are the binary logs for your database. It contains all the statements of updating your database. It another words, it is the archived of your database. Removing it will need some preparations, which is not covered in this post. But the below does suggest a way to move it to another partition or disk :
1. Refer to the "mysql-bin.index" for log files that are in used.
2. Use the
ls -lto decide which file is to leave it in the database directory.
3. Copy the files to another partition or disk. Consider limit the speed so to NOT impact the system performance of the database server.
4. Stop the mysql server by running :
/usr/local/etc/rc.d/mysql-server stopon FreeBSD or
/etc/init.d/mysql stopon Linux
5. Edit the file "mysql-bin.index" and remove the entries of the mysql-bin.0000* that intended to be delete. e.g. mysql-bin.000001, mysql-bin.000002 & so on.
6. Start the mysql server by running :
/usr/local/etc/rc.d/mysql-server starton FreeBSD or
/etc/init.d/mysql starton Linux
7. Delete the mysql-bin.0000* files. If it is too many, consider using the regex approach to the "rm" command.
8. Check what binary log files is mysql server using :
- log into mysql server :
mysql -u admin_username -p
- show the binary logs :
show binary logs;
Voilla !!!
No comments:
Post a Comment