全过程如下:
[root@VM-0-8-opencloudos HQW]# lnmp mysql stop
+-------------------------------------------+
| Manager for LNMP, Written by Licess |
+-------------------------------------------+
| https://lnmp.org |
+-------------------------------------------+
Shutting down MySQL. SUCCESS!
[root@VM-0-8-opencloudos HQW]# mkdir -p /var/run/mysqld
[root@VM-0-8-opencloudos HQW]# chown mysql:mysql /var/run/mysqld
[root@VM-0-8-opencloudos HQW]# mysqld_safe --skip-grant-tables --skip-networking &
[1] 864359
[root@VM-0-8-opencloudos HQW]# 2026-02-05T01:32:11.428584Z mysqld_safe Logging to '/usr/local/mysql/var/VM-0-8-opencloudos.err'.
2026-02-05T01:32:11.480721Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.37 MySQL Community Server - GPL
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxx';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye