SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'

前端 未结 10 588
灰色年华
灰色年华 2020-12-04 12:49

I just installed Ubuntu 16.04 and installed web server on it. Everything works well, but I cannot access database. Even if I create new user and grant all privileges, I can\

10条回答
  •  臣服心动
    2020-12-04 13:39

    MySQL makes a difference between "localhost" and "127.0.0.1".

    It might be possible that 'root'@'localhost' is not allowed because there is an entry in the user table that will only allow root login from 127.0.0.1.

    This could also explain why some application on your server can connect to the database and some not because there are different ways of connecting to the database. And you currently do not allow it through "localhost".

提交回复
热议问题