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、小米盒子4c和4se的区别1413
  2. 2、华米推AMAZFIT米动健康手环1S,售价699元1794
  3. 3、魅族note9手机怎么导入联系人4372
  4. 4、OPPOReno3手机屏幕像素是多少3281
  5. 5、qq大小船消失规则3187
  6. 6、华为nova5z怎么设置单手模式861
  7. 7、小米play怎么打开性能模式3550
  8. 8、小米9se输入法怎么设置3070
  9. 9、瘦瘦APP里打开减肥宣言的简单教程分享2302
  10. 10、qq空间怎么设置转发权限4195
全部评论(0)
我也有话说
0
收藏
点赞
顶部