Error
Error Code:
1598
MariaDB Error 1598: Binary Logging Failure
Description
Error 1598, 'Binary logging not possible', indicates that MariaDB cannot write to its binary log files. This critical issue prevents essential operations like replication, point-in-time recovery, and can impact database stability. It typically occurs when the server encounters an underlying system or configuration problem that obstructs log file creation or writing.
Error Message
Binary logging not possible. Message: %s
Known Causes
4 known causesInsufficient Disk Space
The disk partition designated for MariaDB's binary log files has run out of available space, preventing the creation of new log entries.
Incorrect File Permissions
The MariaDB server process lacks the necessary write permissions for the directory where binary log files are configured to be stored.
Invalid Binary Log Path or Configuration
The path specified for binary log files in the `my.cnf` configuration might be incorrect, inaccessible, or contain a typo.
Underlying Filesystem Problems
Issues with the host operating system's filesystem, such as being mounted read-only or experiencing corruption, prevent MariaDB from writing to its binary logs.
Solutions
3 solutions available1. Verify and Configure `log_bin` Setting easy
Ensure the `log_bin` variable is correctly set in the MariaDB configuration.
1
Check the current value of `log_bin` by connecting to your MariaDB instance and running the following SQL query:
SHOW VARIABLES LIKE 'log_bin';
2
If `log_bin` is OFF or empty, it needs to be enabled. Edit your MariaDB configuration file (typically `my.cnf` or `mariadb.conf.d/50-server.cnf` on Linux). Locate or add the `[mysqld]` section and set `log_bin` to a valid path for your binary log files. For example:
[mysqld]
log_bin = /var/log/mysql/mysql-bin.log
3
If you are enabling binary logging for the first time, you also need to set a unique `server_id`. This is crucial for replication. Add or modify the `server_id` line within the `[mysqld]` section. Use a unique integer for each server in a replication setup.
[mysqld]
log_bin = /var/log/mysql/mysql-bin.log
server_id = 1
4
After saving the configuration file, restart the MariaDB service.
# On systemd-based systems (e.g., Ubuntu 15.04+, CentOS 7+)
sudo systemctl restart mariadb
# On older sysvinit systems
sudo service mysql restart
5
Verify that binary logging is now enabled by running the `SHOW VARIABLES LIKE 'log_bin';` query again.
SHOW VARIABLES LIKE 'log_bin';
2. Check Disk Space and Permissions medium
Ensure there is sufficient disk space and the MariaDB user has write permissions to the binary log directory.
1
Determine the directory where your binary logs are configured to be written. This is specified by the `log_bin` variable (see previous solution). If `log_bin` is not set, MariaDB might try to write to its data directory.
SHOW VARIABLES LIKE 'log_bin';
SHOW VARIABLES LIKE 'datadir';
2
Check the available disk space for the partition where the binary logs will be stored. Use the `df -h` command on Linux.
df -h /path/to/your/log/directory
3
If disk space is low, free up space by deleting old files or expanding the partition.
4
Verify that the MariaDB process user (often `mysql`) has write permissions to the directory specified in `log_bin`. Use `ls -ld` to check directory permissions.
ls -ld /path/to/your/log/directory
5
If permissions are incorrect, grant write permissions to the `mysql` user for that directory. Replace `mysql` with the actual user if it's different.
sudo chown mysql:mysql /path/to/your/log/directory
sudo chmod 750 /path/to/your/log/directory
6
Restart the MariaDB service after making any permission or ownership changes.
# On systemd-based systems
sudo systemctl restart mariadb
# On older sysvinit systems
sudo service mysql restart
3. Resolve Issues with `binlog_format` medium
Ensure a compatible `binlog_format` is set, especially if you're using replication or specific data types.
1
Check the current binary log format by running the following SQL query:
SHOW VARIABLES LIKE 'binlog_format';
2
The recommended and most compatible `binlog_format` is `ROW`. If it's set to `STATEMENT` or `MIXED`, and you are encountering issues, consider changing it to `ROW`. Edit your MariaDB configuration file (`my.cnf` or `mariadb.conf.d/50-server.cnf`) and add or modify the `binlog_format` in the `[mysqld]` section:
[mysqld]
binlog_format = ROW
3
Save the configuration file and restart the MariaDB service.
# On systemd-based systems
sudo systemctl restart mariadb
# On older sysvinit systems
sudo service mysql restart
4
Note: Changing `binlog_format` can affect existing replication setups. If you are replicating, ensure that all replicas are compatible or plan for a controlled switch.