Control Web Panel

WebPanel => MySQL => Topic started by: blackstar on January 21, 2018, 07:57:10 PM

Title: /var/lib/mysql = du -sh = 175G / I want to clear them
Post by: blackstar on January 21, 2018, 07:57:10 PM
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
Title: Re: /var/lib/mysql = du -sh = 175G / I want to clear them
Post by: PavelZh on January 21, 2018, 08:22:55 PM
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!
Title: Re: /var/lib/mysql = du -sh = 175G / I want to clear them
Post by: blackstar on January 21, 2018, 08:31:30 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.*
Title: Re: /var/lib/mysql = du -sh = 175G / I want to clear them
Post by: PavelZh on January 21, 2018, 08:48:00 PM
you should connect to your SQL server using SQL root login,

Code: [Select]
#mysql -u root -p
then execute command in SQL console (172 was used as example)

Code: [Select]
mysql>PURGE BINARY LOGS TO ‘mysql-bin.172’;
then leave SQL console
Code: [Select]
mysql>exit
If you disable binary logging, yes, you can delete this files with rm command when MySQL stopped
Title: Re: /var/lib/mysql = du -sh = 175G / I want to clear them
Post by: blackstar on January 21, 2018, 11:42:45 PM
you should connect to your SQL server using SQL root login,

Code: [Select]
#mysql -u root -p
then execute command in SQL console (172 was used as example)

Code: [Select]
mysql>PURGE BINARY LOGS TO ‘mysql-bin.172’;
then leave SQL console
Code: [Select]
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".