Nội dung
In this article, AZDIGI will show you how to disable mysql-bin on DirectAdmin because this is one of the reasons for the rapid increase in server capacity.
Although the DirectAdmin server does not enable mysql-bin by default, it may be that we have accidentally configured it or you have simply optimized the speed of DirectAdmin’s MySQL in the following way, by default the mysql-bin option is enabled.
I. What is MySql Binary Log?
MySql Binary Log is a mechanism of MySql used to store data changes as a log file. All changes will be appended only to a numbered log file. Each change is characterized by two parameters: the log file is written to the offset on the log file. MySql Binary Log has three types:
- Statement Based: stores statements that change data.
- Row based: store the changed data.
- Mixed: stores both statements and changes data of each row.
However, when activating MySql Binary Log will use a lot of the server’s storage space, and this capacity does not stop at all, it will increase over time as long as there are changes to the data in the database.
So we need to disable mysql-bin
on DirectAdmin.
II. Disable mysql-bin on DirectAdmin
To disable mysql-bin
on DirectAdmin, we follow 3 these steps.
Step 1: SSH into your DirectAdmin system
To disable mysql-bin
on DirectAdmin, we first need to SSH or access your VPS/server with root privileges. If you don’t know how to SSH into your VPS/Server, you can refer to the following tutorial:
After successfully SSH, we continue with step 2 to change the MySQL/MariaDB configuration at my.cnf
file.
Step 2: Disable mysql-bin on DirectAdmin by editing the configuration
Usually, the my.cnf
configuration file will be located at /ect/my.cnf
, and we use the following command to edit the configuration:
vi /etc/my.cnf
At the content of the file configuration, let’s find the configuration line has log-bin=
and disable the whole line by adding a # (hashtag) in front of the line as below. Then save the configuration file.
Note: You must find all log-bin=
configurations and disable it, because there are some cases where we may accidentally configure to 2 lines.
Once disabled, let’s restart MySQL/MariaDB with the following command:
service mysqld restart
Please wait a moment for the MySQL/MariaDB restarts to complete. We can then delete files named mysql-bin.000001, mysql-bin.000002, mysql-bin.000003, mysql-bin.000004… These filenames will depend on the information behind the configuration log-bin=
.
Since my configuration is log-bin=mysql-bin
, my files will be mysql-bin.000001 or higher. Usually, this file will be about 1.1GB
in size. Below is the command that lists the mysql-bin.0000X files on my system that I need to delete.
du -sh /var/lib/mysql/* | grep mysql-bin.0
Then I will use the following command to delete these MySql Binary Log files to free up disk space:
cd /var/lib/mysql/ rm -f mysql-bin.00*
Explanation of the two commands above:
- Command 1: Move to the
mysql
folder. - Command 2: Force delete files that start with
mysql-bin.00
.
After I execute the delete command, then recheck with the following command, no results are displayed anymore.
du -sh /var/lib/mysql/* | grep mysql-bin.0
With the above steps, we can disable mysql-bin
on DirectAdmin successfully.
III. Summary
Thus, AZDIGI has completed the steps to disable mysql-bin
on DirectAdmin. This will help free up a lot of server space when you’ve accidentally left this configuration unnoticed for a long time and also reduce the load since the server doesn’t have to log these logs.
Hope this article will be of help to you. Wishing you success!
See more useful articles about DirectAdmin at the following link:
If you need assistance, you can contact support in the ways below:
- Hotline 247: 028 888 24768 (Ext 0)
- Ticket/Email: You use the email to register for the service and send it directly to: support@azdigi.com .
- Refer to Hosting/VPS service here!