我已经厌倦了尝试这么多不同的事情,我什至无法绕过正在运行的错误。我知道你们中的一些人可能会认为这是一个重复的问题,但我已经看到了几十个问题,所以我认为答案没有那么简单,也没有重复。
这是我尝试过的许多解决方案中的一些:
错误:选择命令拒绝用户 '<userid>'@'<ip-address>' 用于表 '<table-name>'
MySQL 错误:#1142 - SELECT 命令拒绝用户
https://mariadb.com/kb/en/set-password/
错误 1698 (28000): 拒绝用户 'root'@'localhost' 的访问
https://forums.mysql.com/read.php?10,588296
https://dev.mysql.com/doc/refman/8.0/en/resetting-permissions.html
# mysql -u root -p
当它要求输入密码时,无论我输入什么,它都会显示
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 430
Server version: 10.3.23-MariaDB-0+deb10u1 Debian 10
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
show databases;
只显示
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.002 sec)
当我输入
MariaDB [(none)]> use mysql;
ERROR 1044 (42000): Access denied for user 'root'@'%' to database 'mysql'
请注意,它%
不是 localhost,而是暗示正在发生的事情?您是否遇到过同样的问题并能够解决?
即使我输入了正确的密码。我有另一个用户,但我无法更改其密码。
MariaDB [(none)]> select user, plugin from user;
节目
ERROR 1046 (3D000): No database selected
我觉得我真的什么都试过了,我的意思是我已经这样好几个小时了,过去我已经多次更改 mysql 密码,在 windows 和 linux 中使用控制台,我不知道发生了什么!
EIDT:正如评论中所建议的,这里是输出SELECT user, host, plugin from mysql.user;
MariaDB [(none)]> SELECT user, host, plugin from mysql.user;
ERROR 1142 (42000): SELECT command denied to user 'root'@'localhost' for table 'user'
这是输出到> SHOW GRANTS;
MariaDB [(none)]> SHOW GRANTS;
+---------------------------------------------------------------------------------------------------------------+
| Grants for root@% |
+---------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO `root`@`%` IDENTIFIED VIA unix_socket USING '*227A46552108541F24FF4915F91' |
+---------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)