用户工具

站点工具


zh:notes:centos_mysql_pwd

这是本文档旧的修订版!


Reset the Password of MySQL in the CentOS

Stop mysql

> systemctl stop mysqld

Set the MySQL environment Option

> systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"

Start mysql

> mysql -uroot

Update the Password

mysql> USE mysql
mysql> ALTER USER "root"@"localhost" IDENTIFIED BY "MyNewPassword";
mysql> FLUSH PRIVILEGES;
mysql> quit

Stop mysql

> systemctl stop mysqld

Unset the MySQL Environment Option

> systemctl unset-environment MYSQLD_OPTS

Start mysql

> systemctl start mysqld
zh/notes/centos_mysql_pwd.1666442595.txt.gz · 最后更改: 2022/10/22 20:43 由 pzczxs