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. spring cloud 之 -- eureka vs consul,该选择谁?

    0--前言 spring cloud的服务注册中心,该选择谁?在选择前,我们首先需要来了解下分布式的CAP定理: 所谓CAP,是指: Consistency:一致性:就是在分布式系统中的所有数据备份, ...

  2. nginx的部署及配置文件的介绍 域名 用户认证 SSL加密模块

    步骤一:构建Nginx服务器 yum -y install gcc pcre-devel openssl-devel        #安装依赖包 wget   http://nginx.org/dow ...

  3. 面试官:如果 http 响应头中 ETag 值改变了,是否意味着文件内容一定已经更改

    本篇文章由我的 一日一题 中的四个 Issue 组合而成 [Q111]http 响应头中的 ETag 值是如何生成的 [Q112]如果 http 响应头中 ETag 值改变了,是否意味着文件内容一定已 ...

  4. dubbo 订阅 RPC 服务

    Dubbo 订阅 RPC 服务 建立消费者者项目 pom.xml <?xml version="1.0" encoding="UTF-8"?> &l ...

  5. 2017 ACM/ICPC 沈阳 F题 Heron and his triangle

    A triangle is a Heron’s triangle if it satisfies that the side lengths of it are consecutive integer ...

  6. HDU3870-Caught these thieves(最小割-&gt;偶图-&gt;最短路问题)

    A group of thieves is approaching a museum in the country of zjsxzy,now they are in city A,and the m ...

  7. Ceph 提供iSCSI存储

    Tgtd+Ceph部署 一.yum安装tgt [root@c720181 ~]# yum --enablerepo=epel -y install scsi-target-utils libxslt ...

  8. ARTS-S 做事情的正确方法

    有同学改bug的思路是:你们别管我怎么改,先看改的效果对不对.效果对,就这样改,效果不对,我再想别的办法.这样其实把自己关起来,盲目试错,效率太低. 合理的方法应该是和其他大佬们商量一个大家认为正确的 ...

  9. Kerberos+SSH安装配置使用教程

    一.背景说明 最早听说KDC和Kerberos应该是大三的<应用密码学>,当时感觉这套对称密钥分发机制比非对称密钥的PKI分发机制要好理解.但几年下来由于现实中使用SSL的场景比较比(主要 ...

  10. nginx部署基于http负载均衡器

    nginx跨多个应用程序实例的负载平衡是一种用于优化资源利用率,最大化吞吐量,减少延迟和确保容错配置的常用技术. 环境介绍 配置nginx负载均衡器因会用到多台服务器来进行,所以下面我会用到docke ...