使用--skip-grant-tables选项启动MYSQL时,服务器将不加载权限判断,这样就可以进行授权和密码更新操作了,具体步骤如下:

 

1. 停止mysql

/etc/init.d/mysqld stop

 

2. 加载参数启动

/etc/init.d/mysqld start --skip-grant-tables

 

3. 进入mysql命令行,并更新密码

mysql -u root mysql
mysql>UPDATE user SET password=PASSWORD('123456') where USER='root';
mysql> FLUSH PRIVILEGES;

 

4. 重启mysql

/etc/init.d/mysqld restart

搞定

相关文章:

  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2021-11-23
  • 2022-12-23
  • 2022-01-23
猜你喜欢
  • 2021-11-06
  • 2022-12-23
  • 2021-12-05
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案