Error
Error Code: 1836

MariaDB Error 1836: Server Read-Only Mode

📦 MariaDB
📋

Description

Error 1836 indicates that the MariaDB server is currently operating in a read-only state. This prevents any write operations (INSERT, UPDATE, DELETE, DDL statements) from being executed, ensuring data integrity or facilitating specific operational modes.
💬

Error Message

Running in read-only mode
🔍

Known Causes

4 known causes
⚠️
Server Configuration
The MariaDB server instance is intentionally configured to operate in read-only mode, typically set via the `read_only` system variable in the configuration file or at runtime.
⚠️
Replication Slave Role
The server is part of a replication topology and configured as a slave, which by default operates in read-only mode to prevent data inconsistencies with the master.
⚠️
Maintenance or Critical State
The server might be placed in read-only mode during planned maintenance, upgrades, or automatically due to a critical system state to protect data integrity.
⚠️
Accidental Configuration
The `read_only` system variable may have been inadvertently enabled or not reset after a specific operation, leading to unexpected read-only behavior.
🛠️

Solutions

3 solutions available

1. Temporarily Disable Read-Only Mode via SQL easy

Quickly disable read-only mode for the current session or globally.

1
Connect to your MariaDB server using a client like `mariadb` or `mysql` with administrative privileges.
mariadb -u your_admin_user -p
2
To disable read-only mode for the current session only, execute the following SQL command:
SET GLOBAL read_only = OFF;
3
To disable read-only mode globally (affecting all new connections), execute the following SQL command:
SET GLOBAL read_only = 0;
4
Verify that read-only mode is disabled by checking the `read_only` system variable:
SHOW GLOBAL VARIABLES LIKE 'read_only';

2. Permanently Disable Read-Only Mode in Configuration medium

Modify MariaDB configuration files to prevent read-only mode from being enabled on startup.

1
Locate your MariaDB configuration file. Common locations include `/etc/my.cnf`, `/etc/mysql/my.cnf`, or files within `/etc/my.cnf.d/`.
ls /etc/my.cnf /etc/mysql/my.cnf /etc/my.cnf.d/*
2
Open the configuration file using a text editor with root privileges.
sudo nano /etc/my.cnf
3
Look for a section like `[mariadb]` or `[mysqld]` and find the `read_only` or `super_read_only` directive. If it's set to `1` or `ON`, change it to `0` or `OFF`.
[mariadb]
read_only = 0
4
If the `read_only` directive is not present, you can add it under the appropriate section to ensure it's off by default.
[mariadb]
read_only = 0
5
Save the changes to the configuration file and exit the editor.
Ctrl+X, Y, Enter (for nano)
6
Restart the MariaDB service for the changes to take effect.
sudo systemctl restart mariadb

3. Check Replication Status for Read-Only Trigger medium

Investigate if replication is causing the server to enter read-only mode.

1
Connect to your MariaDB server with administrative privileges.
mariadb -u your_admin_user -p
2
Check the `read_only` and `super_read_only` variables. If they are set to `1` or `ON`, this might be due to replication configuration.
SHOW GLOBAL VARIABLES LIKE 'read_only';
SHOW GLOBAL VARIABLES LIKE 'super_read_only';
3
If `read_only` is `ON` and you are using replication, it might be intentionally set by the replication setup. Examine your replication configuration.
SHOW SLAVE STATUS;
4
If `super_read_only` is `ON`, this is typically set by the `read_only` system variable. If you wish to disable this, you would need to set `read_only` to `OFF` (as per Solution 1 or 2).
5
If the server is in read-only mode due to replication (e.g., a replica server), and you need to perform writes, you might need to stop replication or promote the replica to a master. This is an advanced operation and should be done with extreme caution.
🔗

Related Errors

5 related errors