Ubuntu如何修改mysql的账号密码?

1.如果您没有忘记密码的情况下,可以通过UPDATE直接编辑user表来修改密码: 进入数据库mysql -u root mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root'; mysql> FLUSH PRIVILEGES; 2.如果您已经忘记密码: # /etc/init.d/mysql stop                                   1、结束当前正在运行的mysql进程。 # /usr/bin/mysqld_safe --skip-grant-tables     2、用mysql安全模式运行并跳过权限验证。 # mysql -u root                                               3、重开一个终端以root身份登录mysql。 mysql> use mysql;                                          4、修改root用户口令。 Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> update user set Password = PASSWORD('root') where User ='root'; Query OK, 3 rows affected (0.00 sec) Rows matched: 3 Changed: 3 Warnings: 0 mysql> exit # /etc/init.d/mysql restart                                5、结束mysql安全模式,用正常模式运行mysql。 mysql> update mysql.user set password=PASSWORD('新密码') where User='root';                                                                         6、试试你新修改的口令 mysql> flush privileges; mysql> quit
1
25
0
1

相关资讯

  1. 1、哪里长胖最容易富贵3104
  2. 2、鼻子长啥样的人容易发财?2920
  3. 3、2021年5月18日今日凶时查询4346
  4. 4、鼻子看你的婚姻幸福与否815
  5. 5、注定一生富贵的耳朵4458
  6. 6、塔罗测试:爱TA的最佳方式1555
  7. 7、镜子对着墙风水1679
  8. 8、面部污损和疤痕会影响运势吗?3939
  9. 9、镜子对着大门好吗2298
  10. 10、如何选择招财的风铃2108
全部评论(0)
我也有话说
0
收藏
点赞
顶部