Access denied for user 'root'@'localhost'

前端 未结 3 1793
无人共我
无人共我 2020-11-30 15:06

I am trying to fetch records from database. but I am facing this access denied issue. I tried the other solutions mentioned on Stack Overflow like granting privilege to the

3条回答
  •  眼角桃花
    2020-11-30 15:29

    The problem was the permissions granted to root in the information.schema table. 'root'@'%' didnt have any permissions.. And as I was using 127.0.0.1 as my connection address, so it was giving the access denied error.. % is the wildcard for an ip address. so mysql considers root@127.0.0.1 as any other ip address but not localhost. so just granting it permission solved my problem.. Try using some Mysql client like SQLYog etc.. it is easy to grant the privileges and also to view the privileges with the user.

提交回复
热议问题