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、登录验证是否能成功登录,并尝试其他操作验证账户是否正常

Linux MySQL的root无法登录数据库ERROR 1045 (28000)的更多相关文章

  1. MySQL密码正确却无法本地登录,ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

    MySQL密码正确却无法本地登录 报错如下: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password ...

  2. mysql登录遇到ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    执行mysql  -uroot  -p,出现如下问题 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using pass ...

  3. mysql安装在centos7报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    原文链接:http://blog.csdn.net/kuluzs/article/details/51924086 [问题]:mysql版本:5.7.13 首次在centos下安装MySQL,客户端连 ...

  4. mysql 在登陆的时候出现error 1045 (28000): 错误解决办法

    错误显示:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决方案: 1.找到配 ...

  5. mysql新增用户无法登陆问题解决ERROR 1045 (28000)

    mysql增加新用户无法登陆解决方法 ERROR 1045 (28000): Access denied for user 'appadmin'@'localhost' (using password ...

  6. mysql无法远程连接问题(ERROR 1045 (28000): Access denied for user 'root')

    mysql版本 : 8.0.21 使用mysql 作为nextcloud的数据库.之前使用挺正常的,因为被黑客勒索过一次,重新启动了一个mysql的docker镜像. 结果数据库配置老是失败,next ...

  7. Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

    案例环境: 操作系统 :Red Hat Enterprise Linux Server release 5.7 (Tikanga) 64 bit 数据库版本 : Mysql 5.6.19 64 bit ...

  8. linux安装mysql后root无法登录 sql 无法登录

    linux安装mysql后root无法登录 问题:[root@localhost mysql]# mysql -u root -pEnter password: ERROR 1045 (28000): ...

  9. 解决mysql登录报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题

    问题描述: 在ubuntu14.04上安装完MYSQL后,MYSQL默认给分配了一个默认密码,但当自己在终端上使用默认密码登录的时候,总会提示一个授权失败的错误. 报错信息:Access denied ...

随机推荐

  1. NTP服务编译安装报错:/usr/bin/ld: cannot find –lcap

    [root@localhost local]# find / -name "*libcap.so*" [root@localhost ntp-4.2.8p13]# cd /usr/ ...

  2. 【前端】之HTML5基础知识

    HTML5 文件格式 <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...

  3. OOXML中回车等特殊字符处理方法

    问题点:NPOI处理xlsx文档时,将\r写成了换行符. 实例:以下字符abc\rcde 如果直接复制到Excel 2016,显示结果如下(单元格设置为折行显示): 如果用NPOI写入Xlsx文档,显 ...

  4. 【Flask系列】开发一个简单的Flask程序

    知识点 初始化:每一个flask程序都必须创建一个程序实例,遵循WSGI(Web Server Gateway interface)协议,把请求->flask Obj; 创建实例: app = ...

  5. 串的匹配算法--C语言实现

    串这种数据结构,使用是比较多的,但是它的一些方法在更高级的语言中,比如Java,Python中封装的比较完整了.在这里,我只写了串中使用最多的匹配算法,即串的定位操作.串的匹配算法常用的两种就是朴素匹 ...

  6. Python爬虫帮你打包下载所有抖音好听的背景音乐,还不快收藏一起听歌【华为云技术分享】

    版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.net/devcloud/article/detai ...

  7. react-native StatusBar透明

    目录 一 react-native 自定义AppStatusBar 二 配置 android 一 react-native 自定义AppStatusBar 透明 StatusBar字体黑色, 否则是白 ...

  8. nbuoj 2080 洛谷p1025 数的划分

    链接:http://www.nbuoj.com/v8.83/Problems/Problem.php?pid=2820 链接:https://www.luogu.org/problem/P1025 题 ...

  9. numpy的基本API(二)——维数操作

    numpy的基本维数操作API iwehdio的博客园:https://www.cnblogs.com/iwehdio/ 1.np.copyto(dst, src) copyto方法将数组src复制到 ...

  10. Spring整合Shiro 权限 角色 用户关系分析

    Spring整合Shiro 权限 角色 用户关系分析 作者 : Stanley 罗昊 [转载请注明出处和署名,谢谢!] 前置内容 之前我们学习了,使用注解的方式去完成权限的控制,当然,也是静态的,也就 ...