mode_default 0 auto 0 setting in MySQL/MariaDB is not a standard configuration directive, but it may refer to a misconfigured SQL mode, transaction mode, or storage engine behavior.
The most likely issue relates to SQL mode settings. SQL mode controls how MySQL validates and executes SQL statements.
Run the following SQL command in your MySQL/MariaDB client:
SELECT @@sql_mode;
Expected Output Example:
STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION
If you see mode_default 0 auto 0 or an empty result, the configuration might be incorrect and needs to be properly set.
To fix an incorrect SQL mode, set it to a standard configuration that enforces data integrity and proper SQL behavior.
SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION';
SELECT @@sql_mode;
This change is temporary and will be lost when the server restarts. For a permanent fix, proceed to the next section.
To ensure your SQL mode settings persist after server restarts, you need to edit the MySQL configuration file.
The location varies by operating system:
/etc/mysql/my.cnf or /etc/mysql/mysql.conf.d/mysqld.cnf/etc/my.cnfsudo nano /etc/mysql/my.cnf
Find the [mysqld] section in the configuration file. If it doesn't exist, create it. Then add or modify the sql_mode directive:
[mysqld]
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
Apply the changes by restarting the database service:
# For MariaDB
sudo systemctl restart mariadb
# For MySQL
sudo systemctl restart mysql
Now the SQL mode will persist after server reboots.
If the issue relates to storage engines (MyISAM, InnoDB, etc.), you should check and potentially change the default engine.
Run this SQL command to see all available engines and their status:
SHOW ENGINES;
If the default engine is incorrect, you can set it in the my.cnf file:
sudo nano /etc/mysql/my.cnf
default_storage_engine directive in the [mysqld] section:
[mysqld]
default_storage_engine = InnoDB
sql_mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
sudo systemctl restart mysql
| Issue | Fix |
|---|---|
| SQL mode incorrect (mode_default 0 auto 0) | Set SET GLOBAL sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' |
| SQL mode resets after reboot | Add sql_mode directive to my.cnf |
| Wrong storage engine default | Set default_storage_engine = InnoDB in my.cnf |
| Changes not applying | Restart MySQL/MariaDB service |
Following these steps should resolve any issues related to the mode_default 0 auto 0 configuration and ensure MySQL/MariaDB is working correctly!