• MySQL: cannot connect from mysql client nor PHP

    From Jivanmukta@21:1/5 to All on Mon Feb 6 20:57:30 2017
    Sorry for my English.

    I programmed my first application in PHP+MySQL. It was working fine.
    Since a few days I have error connecting to database: Message: mysqli::real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'.
    I tried: "mysql -u root -p -h localhost" and I have "Access denied for
    user root@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
    mysql Ver 14.14 Distrib 5.7.17, for Linux (i686) using EditLine wrapper

    Here you have my privileges:
    mysql> show grants for 'root'@'localhost'; +---------------------------------------------------------------------+
    | Grants for root@localhost | +---------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
    | GRANT PROXY ON ''@'' 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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From luuk@invalid.lan@21:1/5 to Jivanmukta on Sun Feb 19 17:10:49 2017
    On 06-02-17 20:57, Jivanmukta wrote:
    Sorry for my English.

    I programmed my first application in PHP+MySQL. It was working fine.
    Since a few days I have error connecting to database: Message: mysqli::real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'.
    I tried: "mysql -u root -p -h localhost" and I have "Access denied for
    user root@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
    mysql Ver 14.14 Distrib 5.7.17, for Linux (i686) using EditLine wrapper

    Here you have my privileges:
    mysql> show grants for 'root'@'localhost'; +---------------------------------------------------------------------+
    | Grants for root@localhost | +---------------------------------------------------------------------+
    | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
    | GRANT PROXY ON ''@'' 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

    Does the output of this command give the same password on all lines?
    SELECT Host, User, Password
    FROM mysql.user
    WHERE user='root';

    Do you have a password installed for the user 'root'?
    If not, try to set a password:
    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
    (see: https://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html )

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)