ERROR 1142 (42000): GRANT command denied to user ** 或 ERROR 1045 (28000): Access denied for user '**'@'localhost' (using password: YES)

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: ERROR 1142 (42000): GRANT command denied to user ** 或 ERROR 1045 (28000): Access denied for user '**'@'localhost' (using password: YES)

★ 两个错误信息:都可能是权限不够的原因,当然第二个问题也有可能是密码输错了。


一、ERROR 1142 (42000): GRANT command denied to user **

错误产生背景:

在cmd控制台,选择某个用户shan,进入mysql服务:

输入命令:grant all on mysqldemo.t_student to shan@localhost;

结果报错:ERROR 1142 (42000): SELECT, GRANT command denied to user 'shan'@'localhost' for table 't_student'


然后输入命令:`grant all on mysqldemo.t_student to shan@localhost identitied by '密码' with grant option;`

结果报错:ERROR 1142 (42000): GRANT command denied to user 'shan'@'localhost' for table 't_student'

解决:在cmd控制台,选择用户root进入即可。


二、 ERROR 1045 (28000): Access denied for user '**'@'localhost' (using password: YES)

1、考虑是不是密码输错了---实在密码想不起来,那就重装一下mysql,mysql是没有找回密码的服务。

2、权限不够


总结:在cmd进入mysql进行一些权限分配时候,要注意用root用户进入哈~

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
8月前
|
Java
Access denied for user ''@'localhost' (using password: NO)问题的解决
Access denied for user ''@'localhost' (using password: NO)问题的解决
|
8月前
|
缓存 关系型数据库 MySQL
ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘解决方法
ERROR 1698 (28000): Access denied for user ‘root‘@‘localhost‘解决方法
148 0
|
10月前
|
关系型数据库 MySQL 数据库
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘解决方法
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘解决方法
363 1
|
11月前
|
关系型数据库 MySQL 数据安全/隐私保护
|
11月前
|
安全 关系型数据库 MySQL
解决mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES)
解决mysql:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO/YES)
710 0
|
关系型数据库 MySQL 数据库
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
298 0
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)
|
SQL 关系型数据库 MySQL
Access denied for user ‘root‘ @‘123.233.244.218‘(using password:YES)的解决方法
Access denied for user ‘root‘ @‘123.233.244.218‘(using password:YES)的解决方法
171 1
Access denied for user ‘root‘ @‘123.233.244.218‘(using password:YES)的解决方法
|
关系型数据库 MySQL 数据库连接
ERROR 1045 (28000): Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)
ERROR 1045 (28000): Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)
ERROR 1045 (28000): Access denied for user ‘ODBC‘@‘localhost‘ (using password: NO)
|
关系型数据库 MySQL 数据库
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES/NO)
初次安装mysql,net start mysql,然后输入mysql -u root -p, 出现enter password,我直接点击回车,结果出现如果下错误: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)。
4151 1
|
关系型数据库 MySQL SQL
[解决] Error Code: 1044. Access denied for user 'root'@'%' to database
今天在测试集群用的mysql上,遇到个权限的问题: SQLException : SQL state: 42000 com.mysql.jdbc.exceptions.
5129 0