当我试图登录根目录时,我得到了错误1698。
orpheus@Roedelius:~$ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'我这么做是为了修好它
mysql> UPDATE mysql.user SET authentication_string=PASSWORD('woofwoof') WHERE User='root';
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)但这不起作用,现在,当我尝试登录根时,我得到了错误1045。https://stackoverflow.com/questions/39281594/error-1698-28000-access-denied-for-user-rootlocalhost对我同样的问题的回答是,这是因为匿名用户,但我没有。
orpheus@Roedelius:~$ mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)我想,这些都是我的用户,都是匿名的。
mysql> SELECT user, host FROM mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| debian-sys-maint | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| orpheus | localhost |
| root | localhost |
| tom | localhost |
+------------------+-----------+因此,我尝试将所有特权授予root,并再次获得错误1698。
mysql> grant all privileges on *.* to root@localhost identified by 'woofwoof' with grant option;
ERROR 1698 (28000): Access denied for user 'orpheus'@'localhost'当我试图查看根的拨款时,我得到了以下内容
mysql> show grants for 'root'@'localhost';
ERROR 1141 (42000): There is no such grant defined for user 'root' on host 'localhost'但是对于我的另一个用户,奥菲斯,我明白了
mysql> show grants for 'orpheus'@'localhost';
+------------------------------------------------------+
| Grants for orpheus@localhost |
+------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'orpheus'@'localhost' |
+------------------------------------------------------+我不知道为什么会这样,但我只想再次访问根。如果能帮忙,我会很感激的。
发布于 2018-08-03 15:09:30
此解决方案属于以前版本的MySQL。通过使用套接字身份验证登录到MySQL,您可以这样做。
sudo mysql -u root然后可以运行以下命令。
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';https://dba.stackexchange.com/questions/213818
复制相似问题