可以将任何用户登录到mysql数据库

可以将任何用户登录到mysql数据库

我有 mysql 数据库“politechnika_new”和用户“politechnika”,并且拥有该数据库的所有权限,并且主机设置为%,但我无法以该用户身份登录该数据库。

我该如何修复它?

root@ubuntu:/var/www/html/politechnika# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 36
Server version: 8.0.27-0ubuntu0.20.04.1 (Ubuntu)

Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>  select user, host from mysql.user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| politechnika     | %         |
| debian-sys-maint | localhost |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
6 rows in set (0,00 sec)

mysql> SHOW GRANTS FOR 'politechnika';
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Grants for politechnika@%                                                                                                                                                                                                                                                                                                                                                                                |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `politechnika`@`%` WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `politechnika_new`.* TO `politechnika`@`%` WITH GRANT OPTION                                                                                                                                                                                                                                                                                                                     |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0,00 sec)

mysql> exit
Bye
root@ubuntu:/var/www/html/politechnika# mysql -upolitechnika -pPASSSWORD -Dpolitechnika_new
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'politechnika'@'localhost' (using password: YES)
root@ubuntu:/var/www/html/politechnika# 

远程连接也不起作用

拒绝用户“politechnika@'91.222.150.XXX”访问(使用密码:是)

相关内容