I am using a linux system, but the mysql database on the website cannot be connected. I want to restart it. After the restart, mysql prompts mysql daemon failed to start, I will search for some solutions below. If you need them, please refer to them.
In cli mode, run service myqsld start to find the error message "mysql deamon failed to start.
#/Etc/init. d/mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
View the log file of mysqld
# Less/var/log/mysqld. log
/Usr/libexec/mysqld: Can't change dir to 'xxx' (Errcode: 13)
First, view database logs.
Mysqld started
[Warning] Can't create test file xxx. lower-test
[Warning] Can't create test file xxx. lower-test
/Usr/libexec/mysqld: Can't change dir to '/XXX' (Errcode: 13)
[ERROR] Aborting
First, check the permissions and users of the data directory and log directory. The permissions and users are correct. It should be the SELINUX permission restriction.
First, view the current configuration information.
# Getenforce
Enforcing
SELinux is enabled. You only need to disable SELinux.
Close method:
# Setenforce 0 (0 | 1 on | off)
Or
Setsebool ftpd_disable_trans 1
Command.
Of course, the above method is not the best solution. We can just grant permissions.
According to the log situation, the specific analysis and processing is generally
Mysql database permissions: chmod 777-r/var/lib/mysql;
Note: Database User: chown-R mysql: mysql/var/lib/mysql