Re: cannot connect from mysql client nor PHP, only sudo

From: Thomas 'PointedEars' Lahn <PointedEars_at_web.de>
Date: Sat, 11 Feb 2017 16:18:25 +0100
Message-ID: <1904067.Mh6RI2rZIc_at_PointedEars.de>


Jivanmukta wrote:

> 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'_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.

I second Axel’s recommendation: Do not use the “root” account for everyday database access; this is a huge security risk (try SHOW GRANTS to see that).

<http://askubuntu.com/questions/766334/cant-login-as-mysql-user-root-from-normal-user-account-in-ubuntu-16-04>

which I found as the first hit for

<http://en.lmgtfy.com/?q=mysql+requires+sudo>

might provide the solution to your problem.

-- 
PointedEars

Twitter: _at_PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
Received on Sat Feb 11 2017 - 16:18:25 CET

Original text of this message