• Linux MySQL的root无法登录数据库ERROR 1045 (28000)


    Linux环境下,脚本自动安装完数据库,命令行用mysql -uroot -ppasswaord 登录却报了这么个错:
    ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    网上解决办法都差不多,大概做个整理吧:
    1、编辑/etc/my.cnf添加skip-grant-tables
    2、重启MySQL服务(Linux版本不同可能命令略不一样)
    systemctl restart mysqld.service
    3、修改MySQL密码(以下两条命令执行一条即可,根据MySQL版本选择,后一个适合版本比前一个高)
    update user set password=password('我是密码') where user='root' and host='localhost';
    update user set authentication_string=password('我是密码') where user='root' and host='localhost';
    FLUSH PRIVILEGES;
    4、注释掉skip-grant-tables
    5、重启MySQL服务
    6、mysql -uroot -p我是密码
    此时能登录上去,但可能其他大部分操作都会报错
    7、ERROR 1820 (HY000): You must SET PASSWORD before executing this statement
    则再设一次密码即可
    SET PASSWORD = PASSWORD('我是密码');
    8、若报错:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements则修改密码策略,再修改密码。
    mysql> set global validate_password_policy=low;
    9、登录验证是否能成功登录,并尝试其他操作验证账户是否正常

  • 相关阅读:
    登录Mysql看不到Mysql库
    七牛云使用记录
    FFmpeg工具
    解决VMware下CentOS连不上网络问题
    14.中介者模式
    二十三种设计模式(三)
    23种设计模式(二)
    搭建ssm环境
    文件的字符流与字节流读写
    设计模式之用工厂模式实现计算器
  • 原文地址:https://www.cnblogs.com/Lans-word/p/11682013.html
Copyright © 2020-2023  润新知