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用户进入哈~
看到错误信息“denied--不能” 可能是权限不够。
本文来自博客园,作者:一乐乐,转载请注明原文链接:https://www.cnblogs.com/shan333/p/15841026.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步