amy_888 发表于 2018-10-9 06:09:27

MySQL密码忘了怎么办?MySQL重置root密码方法

# ps -ef|grep 3306         # 查看3306实例的PID  
# kill PID               # kill PID
  
# mysqld_safe --skip-grant-table &
  
# > update mysql.user set password=PASSWORD("123456") where user='root' and host='localhost';
  
# > flush privileges;
  
# ps -ef |grep 3306
  
# kill PID                  # mysqld_safe还在后台运行,需kill重启mysql服务
  
# /etc/init.d/mysqld start
  
# mysql -uroot -p123456
  
Welcome to the MySQL monitor.Commands end with ; or \g.
  
... ...
  
mysql>


页: [1]
查看完整版本: MySQL密码忘了怎么办?MySQL重置root密码方法