wdpnodecodes

MYSQL内部修改

登录mysql数据库:mysql -u用户名 -p密码 数据库名,例如:mysql -uroot -p123456 mysql;

修改密码:UPDATE user SET Password = password ( \'新密码\' ) WHERE User = \'root\'

MYSQL外部修改

root用户无密码,设置密码为123456,执行:

mysqladmin -u root password 123456

root有密码(123456),则修改密码为654321,执行:

mysqladmin -u root -p123456 password 654321

        

忘记密码修改:

使用安全模式启动,配置如下:

vi /etc/my.cnf  添加:--skip-grant-tables(修改完密码后去掉或注释掉#重启服务)

重新启动MYSQL:service mysqld restart

或者不修改my.cnf直接执行:./bin/mysqld_safe --skip-grant-tables & 

无需密码直接登录:mysql -uroot mysql

重置密码:UPDATE user SET Password = password ( \'新密码\' ) WHERE User = \'root\'

如果修改密码出现 **mysql修改密码错误 ERROR 1054 (42S22)** 则使用 mysql>update mysql.user set authentication_string=password(\'123456\') where user=\'root\' and Host =\'localhost\';

分类:

技术点:

相关文章:

  • 2021-08-27
  • 2022-12-23
  • 2021-12-16
  • 2021-12-17
  • 2021-11-21
  • 2022-12-23
  • 2022-01-02
猜你喜欢
  • 2021-12-16
  • 2021-12-16
  • 2021-12-05
  • 2021-12-04
相关资源
相似解决方案