How to Solve Error Message mysqld_safe error: log-error set to ‘mysql.error.log’, however file don’t exists. Create writable for user ‘…’

Posted on

In the process of installing MySQL Database Server manually, in this context it is MySQL Database Server with Community Version 5.7, there are several error messages occurs. The following is an error upon starting the MySQL Database Server’s service :

mysqld_safe error: log-error set to 'mysql.error.log', however file don't exists. Create writable for user ....

The error available and it appears after executing the command ‘journalctl -xe’. It is a command in Linux operating system for printing or querying the systemd journal. According to this link, it is a command for viewing logs collected by systemd. The systemd-journald service is responsible for systemd’s log collection, and it retrieves messages from the kernel, systemd services, and other sources. These logs are gathered in a central location, which makes them easy to review. The log records in the journal are structured and indexed, and as a result journalctl is able to present your log information in a variety of useful formats.

So, it is mainly useful to check the systemd log, in order to be more specific, it is to check the MySQL error log. So, there is an error informing that there is an error in ‘mysqld_safe’. The error point out that the file mysql.error.log is not exist. So, the solution is to create the file or just create a user for creating that file. As normally MySQL Database Server’s process, the owner of the process is ‘mysql’ user. According to that reasoning, the following is the attempt to solve the error message :

1. Check the file whether it is exist or not. In order to check the file, the most important thing is to check the MySQL Database Server’s configuration file for defining the behaviour of it. The file usually exist in ‘/etc’ folder with the name of ‘my.cnf’. Just find it  and check the content of the file. The following is the actual content of the file :


2. The location exist in the specific folder as in the above definition. So, just check it in that location. Usually, there are several conditions that can trigger the error. The first one is because the file is actually do not exist. So, create the file my executing the following command :

touch mysqld.error.log

Before creating the file, just check the folder content. If there is no available file with the name of ‘mysqld.error.log’ just create it using the above command.

3. Another condition that can occur is when the file is exist but ‘mysql’ account doesn’t get hold or doesn’t have any permission to modify the file. In this case, just execute the following command to change the file permission :

chmod -Rv /opt/mysq/mysql57/log

The above command execution is for modifying not only the file with the name of ‘mysqld.error.log, instead it is modifying the entire base directory where the file exist. In the above example, it is the folder with the name of ‘log’.

Leave a Reply