Author Topic: /var/lib/mysql = du -sh = 175G / I want to clear them  (Read 11297 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
/var/lib/mysql = du -sh = 175G / I want to clear them
« 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

Offline
*
Re: /var/lib/mysql = du -sh = 175G / I want to clear them
« Reply #1 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!
« Last Edit: January 21, 2018, 08:31:01 PM by PavelZh »

Offline
*
Re: /var/lib/mysql = du -sh = 175G / I want to clear them
« Reply #2 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.*

Offline
*
Re: /var/lib/mysql = du -sh = 175G / I want to clear them
« Reply #3 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
« Last Edit: January 21, 2018, 09:04:31 PM by PavelZh »

Offline
*
Re: /var/lib/mysql = du -sh = 175G / I want to clear them
« Reply #4 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".