This article will show how to solve an error message. The error message appears in the title of this article. It is an error message with a information that the MySQL Database Server can’t start. It is because the process cannot create the PID file. The reason is because it is a directory. So, this article will discuss how to solve the error message. Actually, before going into all of the details, there are several steps or process that will lead into the error. The following are steps executed before that will end into the occurrence of the error message :
1. The manual installation of MySQL Database Server. In this context, it is extracting a compressed file into a certain location. In this example, it is extracting the installer file to ‘/opt/mysql/’. The file for MySQL Database Server installation is ‘mysql-5.7.28-linux-glibc2.12-x86_64.tar.gz’.
2. Next step, it is creating a file for initializing MySQL Database Service. The process for creating that file is simple. Just copy the existing file in the mysql installation source file. It exist in the /opt/mysql/mysql-5.7.28-linux-glibc2.12-x86_64/support-files/mysql.server. Copying that file, the ‘mysql.server’ into ‘/etc/init.d/’ will create a file for starting MySQL Database Server as a service. For an example, the following is the process for copying the file into ‘/etc/init.d/’ folder :
cp /opt/mysql/mysql-5.7.28-linux-glibc2.12-x86_64/support-files/mysql.server /etc/init.d/mysqld57
Continue on to the last step above, there is a slight mistake within the content of the file. There is a line of configuration exist in the file as follows :
Continue on from the previous section, apparently, the line above for defining ‘mysql_pid_file_path’ becomes the source that is triggering the error message. For detail of the error message, after trying to start the service of MySQL Database Server, the following command of ‘journalctl -xe’ is executed to see the detail of messages and the following error message will appear :
2019-12-31T03:10:54.398606Z 0 [ERROR] /opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/bin/mysqld: Can't create/write to file '/opt/mysql/temp/mysql-5.7.28-linux-glibc2.12-x86_64/data' (Errcode: 21 - Is a directory) 2019-12-31T03:10:54.398651Z 0 [ERROR] Can't start server: can't create PID file: Is a directory
The following is the solution for solving the problem. Just change the line of configuration into the following line where it is pointing to a certain file name :
The above is a solution to solve the error message or handling the problem. Just edit the file by modifying the line with the above configuration line. Since it is a directory, just change it into a file for an example ‘mysql.pid’.