Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL Startup Service error reporting solution

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The problem of the source of the error is solved.

1. Authority

It is the source of the error report. Generally speaking, the first thing that comes to mind in this kind of problem is the permission problem, that is, the permission of / var/lib/mysql this folder.

As you can see in the figure above, the users and groups of the mysql folder are all mysql and mysql has write permissions, so there is no problem with permissions.

two。 Process

Check the / var/lib/mysql directory and find that there is no survival mysql.sock file, indicating that mysql is not started. You can also log in to mysql to test.

View the process ps-ef | grep mysql

Found that there is a mysql process, the reason is it, kill dropped, kill-9 pid

Then start the mysql service, service mysql start, my current mysql version is 5.6. in version 5.7, the startup service is service mysqld start, which is a little different.

Looking at the mysql directory, we found that the mysql.sock file was generated

Analysis of problems

Remember the wrong report at the beginning?

Obviously, the mysql process already exists, but why the stop mysql service prompts that the process cannot be found? the main reason is the different processes that store mysql in the process. The solution is to drop these processes according to the kill above. Why does this process occur? Here is my own operation error, when the server starts, mysql has been started automatically, and then I have also executed a service mysql start, which leads to this problem, which is also the cause of the problem. There are many articles on the Internet to solve this problem, but do not find out the cause of the problem, there may be other reasons for this problem, but I am here because I have started the service repeatedly. Because the mysql service does not restart automatically in the mysql5.7 version, I often have the habit of restarting the service, but in version 5.6 mysql is as the system starts automatically, so there is no need to restart the service.

The system automatically restarts the service

Chkconfig command

Use the chkconfig command to query the restart of the service, the command: chkconfig-- list servername, or you can chkconfig-- list all separately.

[0-6] represents the operation mode of the linux system, 0: downtime, 1: single user mode, 2: multi-user without network, 3: multi-user without graphical interface, 4: not in use, 5: x11 with graphical interface, that is, often see linux desktop (default level), 6: restart

You can use chkconfig-level level service name on/off to shut down and start the service

For example, we turn off the automatic startup of mysql at the linux2,3,4,5 runtime level

Chkconfig-level 2345 mysql off

Here is a good summary of an article on automatically starting services: http://www.cnblogs.com/nerxious/archive/2013/01/18/2866548.html

View boot.log Log

Command: cat / var/log/boot.log

Boot.log records the log information of the startup entry.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report