Solution to error reporting in starting MySQL

  

After MySQL is installed, start:/etc/init.d/mysql start, but an error is reported: starting MySQL.. manager of PID file quit without updating f). The following is my summary of the solutions to error reporting. I have installed MySQL in many environments and will report various errors for various reasons. Now make a summary for future reference

1、 View error log

The error report log is the direction light for us to solve the problem. Without the direction light, we have no direction. I once reported an error during installation. There are such errors in the log:
/usr/local/MySQL/bin/mysqld: error while loading shared libraries: libstdc + +. So. 5: cannot open shared object file: no such file or directory. The library file libstdc + +. So. 5 is obviously missing. At this time, we can search the package related to libstdc and install it

2、 Maybe SELinux caused it

If it is CentOS system, SELinux will be enabled by default. At this time, you can close it first, open/etc/SELinux/config, change SELinux = enabling to SELinux = disabled, save the disk, exit and try restarting the machine

3、 Residual data

It is also possible that MySQL is installed on the machine for the second time. There is residual data that affects the startup of the service. Go to the MySQL data directory/data to have a look. If mysql-bin.index exists, delete it as soon as possible. It is the culprit

4、 Determine the permissions of the data directory

The data directory is generally & lt; prefix>/ Data, check its ownership. If you are not the MySQL owner, MySQL users and groups will be created when installing mysql. At this time, you need to modify the users and groups:

chown -R mysql:mysql /var/data

5、 No data directory specified

The/etc/my.cnf configuration file will be used when MySQL does not specify a configuration file at startup. Please open this file to see if a data directory (dataDir) is specified under the [mysqld] section. If not, please set this line under [mysqld]:

datadir =/usr/local/mysql/data

6、 And the MySQL process is running

If this is the second time MySQL is installed on the machine, it is very likely that this will happen. At this time, it is very likely that there are MySQL processes running on the system. You can execute the following command to view:

ps -ef | grep mysql

If the result is more than one line, kill it quickly

7、 The skip federated field is causing trouble

You can check whether there is a skip federated field in the/etc/my.cnf file that has not been commented out. If so, comment it out immediately

8、 Error log directory does not exist

Maybe you still don’t know where the MySQL error log is?At this time, you can execute the command to view:

cd mysql/bin

./mysql_safe

At this time, an error will be reported, and the error will be displayed in the error. Write the error in the XX file in XX directory. Here, check whether this directory and file exist. If not, solve it according to the log instructions. If not, create a directory and modify the permissions and attribution. It is usually/var/lib/MySQL/mysql.error. Note that mysql.error does not need to be created

cd /var/lib

mkdir mysql

chmod 777 mysql

chown mysql:mysql mysql

Similar Posts: