修复ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)
修复ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)
直接修改 mysql.user 表中的权限字段
停用 MySQL 服务并启动 MySQL 安全模式
在终端中执行以下命令停止 MySQL 服务并以安全模式启动:
sudo service mysql stop
sudo mysqld_safe --skip-grant-tables &
以 root 用户连接 MySQL
以 root 用户登录 MySQL:
mysql -u root
修改 mysql.user 表中的权限字段
执行以下 SQL 语句来直接修改 mysql.user 表中的权限字段:
USE mysql;
UPDATE user SET Grant_priv='Y', Super_priv='Y' WHERE User='root' AND Host='%';
UPDATE user SET Grant_priv='Y', Super_priv='Y' WHERE User='root' AND Host='localhost';
FLUSH PRIVILEGES;
重启 MySQL 服务
退出 MySQL 并重启 MySQL 服务:
exit
sudo service mysql restart
重新连接并验证
使用新密码重新连接 MySQL:
mysql -u root -p
输入密码后,执行以下命令确认 root 用户的权限:
SELECT host, user, Grant_priv, Super_priv FROM mysql.user WHERE user='root';
确保 Grant_priv 和 Super_priv 都设置为 'Y'。
再次尝试授予全局权限
授予 root 用户全局权限
使用以下命令授予 root 用户全局权限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '88888888' WITH GRANT OPTION;
FLUSH PRIVILEGES;
授予 game 用户权限(以实际情况为准,我这里有game用户)
然后授予 game 用户在 localhost 上的权限:
GRANT ALL PRIVILEGES ON *.* TO 'game'@'localhost' IDENTIFIED BY '88888888';
FLUSH PRIVILEGES;
检查和验证权限
重新连接并验证
尝试重新连接并验证权限:
mysql -u game -p
使用密码 88888888 连接,确保能成功连接并有适当权限。
修复ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)的更多相关文章
- 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 ...
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)的真正原因
在博客Linux mysql 5.6: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: N ...
- 升级到macOS 10.12 mysqlb报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
系统升级到macOS 10.12后启动mysql后,在终端输入mysql 报错ERROR 1045 (28000): Access denied for user 'root'@'localhost' ...
- 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: YES)) 修改: # ...
- 安装mysql因为/tmp权限不足而导致ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)的解决方案
本机是centos 6.5 安装的mysql是5.1的版本. 在安装mysql之后,第一次启动mysql服务的时候,需要/tmp有777(rwxrwxrwx)的权限,然而楼主的/tmp是755(rw ...
- MySQL5.5出面ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)问题的解决办法
问题描述 安装完MySQL5.5数据库,使用Navicat Premium以及命令窗口连接数据库都报以下错误: ERROR 1045 (28000): Access denied for user ' ...
- MySQL学习笔记——ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) Enter password: E ...
- ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) ERROR 2013 (HY00 ...
- ERROR 1045 (28000): Access denied for user root@localhost (using password:
错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL ...
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YSE)
安装mysql后,使用命令登录mysql居然报错了,Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using ...
随机推荐
- PaddleOCR在 windows下的webAPI部署方案
很多小伙伴在使用OCR时都希望能过采用API的方式调用,这样就可以跨端跨平台了.本文将介绍一种基于python的PaddleOCR识方案.喜欢的可以关注公众号,获取更多内容. # 一. windows ...
- MQ的相关概念
MQ的相关概念 什么是MQ MQ(message queue),从字面意思上看,本质是个队列,FIFO 先入先出,只不过队列中存放的内容是 message 而已,还是一种跨进程的通信机制,用于上下 ...
- react 数组列表
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- C# .NET 操作Windows hosts
C# .NET 操作Windows hosts 工具类HostsUtil: using System; using System.IO; using System.Text; namespace Co ...
- .NET5 .NET CORE 使用Apollo
Apollo默认有一个"SampleApp"应用,"DEV"环境 和 "timeout" KEY. nuget 中下载 "Com. ...
- a标签的title属性 换行
使用 title 属性,可以让鼠标悬停在超链接上的时候,显示该超链接的文字注释. <a href="#" title = "123">超链接< ...
- Python使用.NET开发的类库来提高你的程序执行效率
Python由于本身的特性原因,执行程序期间可能效率并不是很理想.在某些需要自己提高一些代码的执行效率的时候,可以考虑使用C#.C++.Rust等语言开发的库来提高python本身的执行效率.接下来, ...
- httpx的使用
urllib和requests库已经可以爬取大多数网站的数据,但对于一些强制使用HTTP/2.0协议访问,这时urllib和requests是无法爬取数据的,因为只支持HTTP/1.1,不支持HTTP ...
- Spring Boot 整合 Fisco Bcos(部署、调用区块链合约)
简介 在上一节,介绍了Spring Boot 整合 Fisco BCOS的最最基础的案例(SpringBoot成功连接Fisco BCOS,并访问其节点网络 --> 文章链接). 本节,咱们继续 ...
- Java面试知识点(四)重写和重载
重写override 在 java 中有很多的继承,继承下来的有变量.方法.在有一些子类要实现的方法中,方法名.传的参数.返回值跟父类中的方法一样,但具体实现又跟父类的不一样,这时候我们就需要重写父类 ...