★ 兩個錯誤信息:都可能是權限不夠的原因,當然第二個問題也有可能是密碼輸錯了。
一、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--不能” 可能是權限不夠。