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 failed to start, no pid error reported

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

A few days ago, after installing Mysql, it failed to start mysqld, and it took a long time to find out the cause. Now, according to the solution provided by netizens, you can refer to it when you encounter it.

Symptom: the following error is prompted when service mysql start:

[root@mysqldb data] # service mysql start

Starting MySQL..The server quit without updating PID file ([failed] / data/3306/mysql.pid).

Cause analysis: the mysql.pid file is created when the mysql is reactivated. If the creation fails, the error will be prompted. It is found that there are many reasons for this error.

Such as permissions, port occupied, parameter file configuration error, and so on, the details are as follows:

Solution:

There are no pid files or are not authorized in the datadir data directory of mysql

(1) be sure to authorize such as / data/mysql

Chown-R mysql:mysql / data/mysql

(2) if the authorization does not work, you can create a pid named by the host name under / data/mysql, for example, my host name is centos-6.3

You can cd / data/mysql & & touch centos-6.3.pid to write a pid number that is not available in the process.

(3) if it still doesn't work, you need to look at the configuration in the configuration file / etc/my.cnf and remove the # before port, datadir, basedir and socket.

(4) the other treatment methods may be caused by the following reasons

1 > it may be the second time to install mysql on the machine, and there is residual data that affects the startup of the service. Solution: go to mysql's data directory / data. If mysql-bin.index exists, delete it as soon as possible. It's the culprit. 2 > mysql will use the / etc/my.cnf configuration file when it starts without specifying a configuration file. Please open this file to see if there is a specified data directory (datadir) under the [mysqld] section. Solution: please set this line under [mysqld]: datadir = / usr/local/mysql/data 3 > skip-federated field solution: check the / etc/my.cnf file to see if there are any skip-federated fields that have not been commented out, and if so, comment them out immediately. 4 > if it is a disaster caused by selinux, if it is a centos system, the default solution is to turn on selinux: close it, open / etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, and then save the disk and exit and restart the machine.

(5) since it is started by system command, check whether the configuration items in the mysql.server configuration file are correct. If you can't judge whether the parameters are correct, you can start with Mysqld_safe.

The reference command is as follows:

[root@mysqldb 3306] # ll

Total 8

Drwxr-xr-x 5 mysql mysql 4096 Mar 15 19:16 data

-rw-r--r-- 1 mysql mysql 3676 Mar 15 18:44 my.cnf

[root@mysqldb 3306] # vi mysql.start-create

/ mysql/app/mysql/bin/mysqld_safe-defaults-file=/mysql/data/3306/my.cnf-user=mysqld

[root@mysqldb 3306] # chmod-R 777 mysql.start-Authorization

[root@mysqldb 3306] # ll

Total 12

Drwxr-xr-x 5 mysql mysql 4096 Mar 15 19:16 data

-rw-r--r-- 1 mysql mysql 3676 Mar 15 18:44 my.cnf

-rwxrwxrwx 1 root root 89 Mar 15 22:36 mysql.start

[root@mysqldb 3306] #. / mysql.start

[root@mysqldb 3306] # 2018-03-15T14:36:52.021705Z mysqld_safe Logging to'/ mysql/log/3306/mysqldb-error.err'.

2018-03-15T14:36:52.043126Z mysqld_safe Starting mysqld daemon with databases from / mysql/data/3306/data

[root@mysqldb 3306] # ps-ef | grep mysqlroot

3627 10 22:36 pts/0 00:00:00 / bin/sh / mysql/app/mysql/bin/mysqld_safe-defaults-file=/mysql/data/3306/my.cnf-user=mysqldmysql

4764 3627 48 22:36 pts/0 00:00:11 / mysql/app/mysql/bin/mysqld-defaults-file=/mysql/data/3306/my.cnf-basedir=/mysql/app/mysql-datadir

= / mysql/data/3306/data-plugin-dir=/mysql/app/mysql/lib/plugin-user=mysqld-log-error=/mysql/log/3306/mysqldb-error.err-open-files-limit=65536

-pid-file=/mysql/data/3306/mysql.pid-socket=/mysql/data/3306/mysql.sock-port=3306

Root 4796 2174 0 22:37 pts/0 00:00:00 grep mysql

(6) whether the command is correct when Mysql is closed, point 6 is not consistent with the description of this article, but this incorrect closure will also lead to this phenomenon.

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