1. Background
After installing mysql, change the configuration file my.int, and change its data directory. Restart MySQL and it cannot be started.
2. Troubleshooting
Check the log and find that the error is:
[ERROR] Can't find error-message file '/data/mysql/share/mysql/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
By searching the errmsg.sys file, copy it to the error directory and give corresponding permissions. Restart or report the same error. Change the MySQL configuration file back to the default. It is found that it can be started normally, and there is no other relevant error information in the log.
3. Solution
After troubleshooting for a period of time without results, I thought about whether the file could not be found due to the Linux security group SELinux. I closed SELinux randomly and found that the problem was solved.
setenforce 0 #Temporarily disable selinux
Change SELINUX=enforcing to SELINUX=disabled in the /etc/selinux/config file # permanently disable selinux
getenforce #Check the status of selinux