0

I have mysql database 'politechnika_new' and user 'politechnika' with all privilages for this daabase, and host set as %, but I can't login to this database with this user.

How Can i fix it?

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# 

Remotly connection's also not working

Access denied for user 'politechnika@'91.222.150.XXX` (using password: YES)

9
  • 1
    Does this answer your question? MySQL cannot connect via "localhost", only 127.0.0.1
    – user9517
    Jan 7, 2022 at 10:05
  • @user9517 - No, I also can't connect specifying the host as 127.0.0.1 Jan 7, 2022 at 10:31
  • Did you try resetting the password with an ALTER USER politechnika@%'IDENTIFIED BY 'password'; and flush privileges;
    – Bob
    Jan 7, 2022 at 10:45
  • @Bob - changing my password solved my problem. I don't know why - I'm pretty sure I used the correct password. Thanks! Jan 7, 2022 at 10:50
  • Please change it again to something different (and stronger) from the clear text password that you included in the question.
    – Bob
    Jan 7, 2022 at 10:56

0

You must log in to answer this question.

Browse other questions tagged .