标签:user pts The ... 操作 set 密码 roo 过程
密码是一个非常重要的东西,所以往往设置的很复杂,也往往一不小心.......就忘了 : (
很多童鞋在Linux下看到一堆命令行往往都是一脸懵逼,不知从何下手,这里记录了下基本的恢复操作以备不时之需!
systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
systemctl start mysqld
mysql -u root
mysql> UPDATE mysql.user SET authentication_string = PASSWORD(‘MyNewPassword‘) -> WHERE User = ‘root‘ AND Host = ‘localhost‘; mysql> FLUSH PRIVILEGES; mysql> quit
systemctl stop mysqld
systemctl unset-environment MYSQLD_OPTS
systemctl start mysqld
mysql -u root -p
GRANT ALL PRIVILEGES ON *.* TO ‘root’@‘%‘ IDENTIFIED BY ‘password‘ WITH GRANT OPTION; FLUSH PRIVILEGES;
标签:user pts The ... 操作 set 密码 roo 过程
原文地址:https://www.cnblogs.com/linkanyway/p/reset-mysql-pass.html