mysql startup failure problem and scenario analysis

mysql startup failure problem and scenario analysis

1. One-stop solution

1. Problem analysis and location

# Find the MySQL configuration file and copy the MySQL data directory vim /etc/my.cnf

# Enter the msyql data directory cd /data/mysql

# View the log file vim mysql.err

[ERROR] The server_uuid stored in auto.cnf file is not a valid UUID.
[ERROR] Initialization of the server's UUID failed because it could not be read from the auto.cnf file. If this is a new server, the initialization failed because it was not possible to generate a new UUID.
[ERROR] Aborting

From the above log, it can be seen that my uuid does not meet the verification. Since I copied it from the same virtual machine, the uuid is like this. Just modify the value of uuid

Solution

find / -iname "auto.cnf"

vim /data/mysql/auto.cnf

# Original content [auto]
server-uuid=64cbb3d1-e150-11eb-81a2-000c2972fe1f

# After adjustment, you can customize the content and replace the last digit f with a
[auto]
server-uuid=64cbb3d1-e150-11eb-81a2-000c2972fe1a


# Restart mysql
# centos7.x
systemctl restart mysql

# centos6.x
service myqld restart

2. Special Scenarios

2.1. Problem Analysis and Location

Generally, this summary situation occurs when the mysql.pid under the mysql root directory is gone due to a malfunction.

cd /data/mysql
ll

2.2. Solution

Just restore mysql.pid. If it cannot be restored, create a new file named mysql.pid and add the pid of mysql running. This pid is in the mysql.sock.lock file. First find the location of mysql.sock.lock.

# Find my.cnf
find / -iname "my.cnf"

# View the file content cat /etc/my.cnf

# Find this line of the my.cnf file socket=/tmp/mysql.sock

# Go to /tmp/
cd /tmp/

# View the contents of the file cat mysql.sock.lock 

insert image description here

# The number 9136 in the mysql.sock.lock file is the pid of mysql's operation
# Create mysql.pid in the root directory of mysql
vim mysql.pid

# Add 9136 in the mysql.sock.lock file just now # Restart mysql
systemctl restart mysql

# View mysql status systemctl status mysql

Solution 2

This is a special case. What should I do if there is no mysql.sock.lock or mysql.pid file?

# Find my.cnf
find / -iname "my.cnf"

# View the file content cat /etc/my.cnf

# Find this line of the my.cnf file socket=/tmp/mysql.sock

# Go to /tmp/
cd /tmp/

# View the contents of the file vim mysql.sock.lock

# Add a pid that is not used in the current system. If you don't know how to check it, just randomly add a 4-digit number. For example, 9137

# Create mysql.pid in the root directory of mysql
vim mysql.pid

# Add 0137 in the mysql.sock.lock file to the mysql.pid file. Just keep it consistent. # Restart mysql
systemctl restart mysql

# View mysql status systemctl status mysql

This is the end of this article about mysql startup failure problems and solutions. For more related mysql startup failure content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Solve the problem of PhPStudy MySQL startup failure under Windows system
  • Solution to the failure of MySQL service startup during MySQL 5.7.18 installation
  • Perfect solution to MySQL common insufficient memory startup failure
  • Solution to MySQL initialization and startup failure in Docker
  • Solution to MySQL database innodb startup failure and inability to restart
  • Quick solution to MySQL service startup failure under CentOS 7
  • Reasons and solutions for the failure of Mysql/MariaDB startup due to the progress bar state
  • Sharing the problem of mysql startup failure caused by disk full

<<:  Div can input content without using input as an input box to block the automatic input style

>>:  Learning about UDP in Linux

Recommend

Detailed explanation of how Zabbix monitors the master-slave status of MySQL

After setting up the MySQL master-slave, you ofte...

Use of Linux relative and absolute paths

01. Overview Absolute paths and relative paths ar...

Ubuntu 20.04 Chinese input method installation steps

This article installs Google Input Method. In fac...

Detailed explanation of mysql scheduled tasks (event events)

1. Brief introduction of the event An event is a ...

How to quickly clean up billions of data in MySQL database

Today I received a disk alarm exception. The 50G ...

Learn how to write neat and standard HTML tags

Good HTML code is the foundation of a beautiful w...

JavaScript example code to determine whether a file exists

1. Business Scenario I have been doing developmen...

CSS eight eye-catching HOVER effect sample code

1. Send effect HTML <div id="send-btn&quo...

Solutions to the failure and invalidity of opening nginx.pid

Table of contents 1. Problem Description 2. Probl...

CSS3 realizes the animation of shuttle starry sky

Result: html <canvas id="starfield"&...

RGB color table collection

RGB color table color English name RGB 16 colors ...

Detailed explanation of the difference between docker-compose ports and expose

There are two ways to expose container ports in d...

Detailed explanation of concat related functions in MySQL

1. concat() function Function: Concatenate multip...