/var/lib/mysql = du -sh = 175G / I want to clear them

Started by blackstar, January 21, 2018, 07:57:10 PM

Previous topic - Next topic

blackstar

Hello
cd var/lib/mysql

http://prntscr.com/i3lu4l

I want to clean these files securely. how can I do that ? and I do not want to keep the log. can you help me ?
MySQL version: 10.1.30-MariaDB
centos 6
Apache version: Apache/2.4.29
PHP version: 5.6.31
thanks

PavelZh

#1
https://dev.mysql.com/doc/refman/5.7/en/purge-binary-logs.html
https://mariadb.com/kb/en/library/sql-commands-purge-logs/

You need to use phpMyAdmin or mysql console client to do this.
Don't delete this files using OS shell!

blackstar

Quote from: PavelZh on January 21, 2018, 08:22:55 PM
https://dev.mysql.com/doc/refman/5.7/en/purge-binary-logs.html

You need to use phpMyAdmin or mysql console client to do this.
Don't delete this files using OS shell!

Thank you, but I do not know exactly what I need to do.

I closed this line with "#" in the file "log-bin = mysql-bin" in /etc/my.cnf.
later, I did "service mysqld restart".
and now can I manually delete those files? >> rm -rf mysql-bin.*

PavelZh

#3
you should connect to your SQL server using SQL root login,

#mysql -u root -p

then execute command in SQL console (172 was used as example)

mysql>PURGE BINARY LOGS TO 'mysql-bin.172';

then leave SQL console
mysql>exit

If you disable binary logging, yes, you can delete this files with rm command when MySQL stopped

blackstar

Quote from: PavelZh on January 21, 2018, 08:48:00 PM
you should connect to your SQL server using SQL root login,

#mysql -u root -p

then execute command in SQL console (172 was used as example)

mysql>PURGE BINARY LOGS TO 'mysql-bin.172';

then leave SQL console
mysql>exit

If you disable binary logging, yes, you can delete this files with rm command when MySQL stopped

Thank you so much. I deleted it with "rm -rf file name".