修复ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)

直接修改 mysql.user 表中的权限字段

停用 MySQL 服务并启动 MySQL 安全模式

在终端中执行以下命令停止 MySQL 服务并以安全模式启动:

  1. sudo service mysql stop
  2. sudo mysqld_safe --skip-grant-tables &

以 root 用户连接 MySQL

以 root 用户登录 MySQL:

  1. mysql -u root

修改 mysql.user 表中的权限字段

执行以下 SQL 语句来直接修改 mysql.user 表中的权限字段:

  1. USE mysql;
  2. UPDATE user SET Grant_priv='Y', Super_priv='Y' WHERE User='root' AND Host='%';
  3. UPDATE user SET Grant_priv='Y', Super_priv='Y' WHERE User='root' AND Host='localhost';
  4. FLUSH PRIVILEGES;

重启 MySQL 服务

退出 MySQL 并重启 MySQL 服务:

  1. exit
  2. sudo service mysql restart

重新连接并验证

使用新密码重新连接 MySQL:

  1. mysql -u root -p

输入密码后,执行以下命令确认 root 用户的权限:

  1. SELECT host, user, Grant_priv, Super_priv FROM mysql.user WHERE user='root';

确保 Grant_priv 和 Super_priv 都设置为 'Y'。

再次尝试授予全局权限

授予 root 用户全局权限

使用以下命令授予 root 用户全局权限:

  1. GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '88888888' WITH GRANT OPTION;
  2. FLUSH PRIVILEGES;

授予 game 用户权限(以实际情况为准,我这里有game用户)

然后授予 game 用户在 localhost 上的权限:

  1. GRANT ALL PRIVILEGES ON *.* TO 'game'@'localhost' IDENTIFIED BY '88888888';
  2. FLUSH PRIVILEGES;

检查和验证权限

重新连接并验证

尝试重新连接并验证权限:

  1. mysql -u game -p

使用密码 88888888 连接,确保能成功连接并有适当权限。

修复ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 升级到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' ...

  4. 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)) 修改: # ...

  5. 安装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 ...

  6. 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 ' ...

  7. 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 ...

  8. 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 ...

  9. ERROR 1045 (28000): Access denied for user root@localhost (using password:

    错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL ...

  10. 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 ...

随机推荐

  1. 获得centos7网络yum源

    获得centos73网络yum源 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 网易 wget -O /etc/yum.repos.d ...

  2. kali linux主题美化

    Kali 主题美化 先放张安装了主题的图片: 执行下面命令下载主题文件: git clone https://github.com/daniruiz/flat-remix-gtk.git git cl ...

  3. ABC351

    我多久没更新这个系列了啊 E 把格子分成两类,每一类之间的坐标均可互相走到. 然后将这里面的点都旋转 \(45\) 度,于是这个问题就被转换成曼哈顿距离的问题了. 我们可以把 \(x\) 和 \(y\ ...

  4. 企业级私有仓库Harbor

    仓库的概念也就是用于存储,docker仓库用于存储镜像. 镜像构建完成后,很容易可以在宿主机上运行,但是如果要在其他服务器上运行,则需要考虑镜像的分发,存储的问题. 共有/私有/仓库 Docker R ...

  5. ssh进阶

    1.ssh客户端工具 查看参数和帮助方法 ==ssh --help== ==man ssh== 常见参数 windows linux macos 提供的ssh命令,会有些区别,查看帮助后使用即可. l ...

  6. sql的删除语句

    好久没用过sql的删除语句了,今天写删除语句的时候报错了,应该是:   DELETE FROM 表名称 WHERE 列名称 = 值 我写成了: DELETE FROM 表名称 别名 WHERE 别名. ...

  7. thinkpad t490触摸板失灵解决方法

    笔记本电脑之前触摸板使用正常,可能在某次更新之后,发现失灵不可用. 解决方法: 更新或滚动触摸板驱动程序 当您在设备管理器中时,右键单击列表中的触摸板(可能称为Dell TouchPad,Lenovo ...

  8. python提取特定格式的数据

    Excel Grid Data Converter 知识点总结 本文档总结了 ExcelGridConverter.py 脚本所涉及的关键 Python 知识点.该脚本用于从多个 Excel 文件中提 ...

  9. V4L2视频采集操作流程和接口说明

    背景: V4L2是V4L的升级版本,为linux下视频设备程序提供了一套接口规范.包括一套数据结构和底层V4L2驱动接口. <WAV文件格式分析> 一般操作流程(视频设备): 1.打开设备 ...

  10. 【论文阅读】End-to-End Model-Free Reinforcement Learning for Urban Driving Using Implicit Affordances

    文章名:CVPR2020: End-to-End Model-Free Reinforcement Learning for Urban Driving Using Implicit Affordan ...