No matter what kind of problem is found, first check the err log.
Question 1:
Querying the err log shows permission issues.
Analysis: mysql originally belongs to the mysql user. If it is started under the root user, problems may occur.
Solution:
(1) Check the permissions of mysql
(2) Found that there is root permission, which is confusing. So first change it to mysql permission
Related video tutorial recommendation:linux video tutorial
(3) Restart and view the process
Question 2:
When I changed the mysql password, I found that the mysql service was running normally, but when I logged in, it prompted: ERROR! MySQL is running but PID file could not be found
Solution:
(1) Check the database running status:
service mysql status
PromptERROR! MySQL is running but PID file could not be found
(2) Print MYSQL process
ps aux | grep mysql
(3) KILL process:
kill -9 pid
That is,
kill -9 9525
restart MYSQL:
service mysql start
and then check the mysql running status:
service mysql status
prompts successful OK
(4) Change password
Recommended related articles and tutorials: linux tutorial
The above is the detailed content of mysql cannot be started in linux environment. For more information, please follow other related articles on the PHP Chinese website!