Warning
Error Code:
54
MySQL Error 54: Insecure Config File Ignored
Description
This error indicates that MySQL has detected one of its configuration files (e.g., `my.cnf` or `my.ini`) has permissions that allow any user on the system to write to it. MySQL considers world-writable files a critical security vulnerability and will ignore the file to prevent potential tampering, meaning your intended configuration settings will not be applied.
Error Message
World-writable config file '%s' is ignored.
Known Causes
3 known causesManual Permission Misconfiguration
A system administrator or user manually set overly permissive permissions (e.g., `chmod 777`) on the configuration file, making it world-writable.
Incorrect umask Setting
The system's `umask` setting is too permissive, causing newly created files, including MySQL configuration files, to inherit world-writable permissions by default.
Automated Deployment Error
An automated script or deployment tool created or modified the configuration file without enforcing sufficiently restrictive permissions, leading to a world-writable state.
Solutions
3 solutions available1. Restrict Permissions on MySQL Configuration File easy
Change file permissions to prevent world-writable access.
1
Identify the path to your MySQL configuration file. This is often `my.cnf` or `my.ini` and is usually located in `/etc/mysql/`, `/etc/`, or the MySQL data directory.
ls -l /etc/mysql/my.cnf
2
Use the `chmod` command to remove world-writable permissions. A common secure setting is `644` (owner read/write, group read, others read) or `640` (owner read/write, group read, no access for others).
sudo chmod 644 /etc/mysql/my.cnf
3
Verify the permissions have been updated.
ls -l /etc/mysql/my.cnf
4
Restart the MySQL service for the changes to take effect.
sudo systemctl restart mysql
2. Change Ownership of the MySQL Configuration File medium
Ensure the configuration file is owned by the MySQL user.
1
Determine the user and group that the MySQL server runs as. This is typically `mysql`.
ps aux | grep mysql
2
Use the `chown` command to change the ownership of the configuration file to the MySQL user and group.
sudo chown mysql:mysql /etc/mysql/my.cnf
3
After changing ownership, ensure the permissions are also restrictive (e.g., `644`).
sudo chmod 644 /etc/mysql/my.cnf
4
Restart the MySQL service.
sudo systemctl restart mysql
3. Locate and Secure All MySQL Configuration Files advanced
Find all potential configuration files and secure them.
1
Check the MySQL server's `my.cnf` file for `!includedir` or `!include` directives to identify other configuration files or directories that are being read.
grep -E '(!includedir|!include)' /etc/mysql/my.cnf
2
Recursively check the permissions of all files within these included directories.
sudo find /etc/mysql/conf.d/ -type f -perm /o+w -ls
3
For any world-writable configuration files found, apply restrictive permissions using `chmod`.
sudo chmod 644 /path/to/insecure/config/file
4
Also, ensure the ownership of these files is appropriate (usually `mysql:mysql`).
sudo chown mysql:mysql /path/to/insecure/config/file
5
Restart the MySQL service.
sudo systemctl restart mysql