Connect to mysql server without sudo

后端 未结 9 1202
暖寄归人
暖寄归人 2020-12-02 08:39

The command:

mysql -u root -p

gives the error:

ERROR 1698 (28000): Access denied for user \'root\'@\'localhost\'
         


        
9条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 08:58

    The error Message:

    "ERROR 1698 (28000): Access denied for user 'root'@'localhost'"

    means that the Server not allow the connect for this user and not that mysql cant access the socket.

    try this to solve the problem:

    Login in your DB

    sudo mysql -u root -p
    

    then make these modifications:

    MariaDB []>use mysql;
    MariaDB [mysql]>update user set plugin=' ' where User='root';
    MariaDB [mysql]>flush privileges;
    MariaDB [mysql]>exit
    

    try login again without sudo

提交回复
热议问题