mysql root密码重置
[root@mysql-test etc]# systemctl stop mysqld.service
[root@mysql-test etc]# /home/cmcs/package/mysql/bin/mysqld_safe --skip-grant-tables &
[root@mysql-test etc]# /home/cmcs/package/mysql/bin/mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.44 MySQL Community Server - GPL
Copyright (c) 2000, 2025, 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.07 sec)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Xysd@123!@#';
Query OK, 0 rows affected (0.05 sec)
mysql>

浙公网安备 33010602011771号