How to turn off binary logging in MySQL and MariaDB?

I have a VPS server where everything was running smoothly, but recently the MySQL server stopped working. After investigating, I discovered that there was no disk space left on the server, which was strange because the server had a large amount of storage. After further research, I found that the MySQL binary log files took up most of the disk space. I tried to PURGE these files, but they were created again within a few days. This has now become a routine task for me, but I’m wondering if there is a way to permanently stop the creation of binary log files in MariaDB. I’m running MariaDB version 10.7.3 on a Centos 7 server. Any help would be greatly appreciated.

To disable binary logging in MariaDB, you can follow these steps:

Stop the MariaDB server.

systemctl stop mariadb 
# or 
service mariadb stop
# or
service mysqld stop 

Edit the MariaDB configuration file. Use vim or vi command line tool

vi /etc/my.cnf 
# or 
vi /etc/mysql/my.cnf 

The configuration file for MariaDB is typically located in those directories.

Add the following line under [mysqld] directive

skip-log-bin

Note: If you find log-bin under [mysqld] directive, place skip-log-bin after log-bin, or it will not work.
You can disable any options by adding a skip in front of the option.

Restart the MariaDB server.

systemctl start mariadb 
# or 
service mariadb start
# or 
service mysqld start

Verify that binary logging is disabled

SHOW VARIABLES LIKE 'log_bin';

If the value returned is OFF, binary logging is disabled.

Check existing binary files.

SHOW BINARY LOGS;

Delete existing binary files.