cannot connect from mysql client nor PHP, only sudo

From: Jivanmukta <jivanmukta_at_poczta.onet.pl>
Date: Fri, 10 Feb 2017 11:04:49 +0100
Message-ID: <o7k381$lfs$1_at_news.icm.edu.pl>



[Quoted] Sorry for my English.

[Quoted] [Quoted] I programmed my first application in PHP+MySQL. It was working fine. Since a few days I have error connecting to database: Message: [Quoted] mysqli::real_connect(): (HY000/1698): Access denied for user 'root'_at_'localhost'.
I tried: "mysql -u root -p -h localhost" and I have "Access denied for user root_at_localhost'.
Command "sudo mysql -u root -p -h localhost" works fine. In mysql log I have only access denied.
Reinstalling mysql doesn't help. mysql_upgrade doesn't help, either.

$ mysql --version
[Quoted] mysql Ver 14.14 Distrib 5.7.17, for Linux (i686) using EditLine wrapper

Here you have my privileges:
[Quoted] [Quoted] mysql> show grants for 'root'_at_'localhost';

+---------------------------------------------------------------------+

| Grants for root_at_localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'_at_'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''_at_'' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
2 rows in set (0,00 sec)

Please help. I would like to avoid reinstalling Ubuntu. $ uname -a
Linux pecet 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:41:41 UTC 2016 i686 i686 i686 GNU/Linux Received on Fri Feb 10 2017 - 11:04:49 CET

Original text of this message