0

I have installed mysql as a service and is running.

enter image description here

But when I try to start mysql I get this error:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

What is the problem? I can't seem to find any relevant solution.

Any suggestion is appreciated. Thanks for the same.

Edit:

enter image description here Here is my screenshot for the error.

Siddhant Sahni
  • 137
  • 1
  • 11
  • in your screenshot MySQL is started but can't seen your error message – Inazo Aug 27 '18 at 07:31
  • Do you want me to add the screenshot for the error in the command prompt as well? – Siddhant Sahni Aug 27 '18 at 07:33
  • Possible duplicate of [MySQL ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)](https://stackoverflow.com/questions/10299148/mysql-error-1045-28000-access-denied-for-user-billlocalhost-using-passw) – SolveProblem Aug 27 '18 at 07:35
  • @selah1936 I don't think it is. I just installed mysql. And moreover, I haven't even added any database. – Siddhant Sahni Aug 27 '18 at 07:41
  • follow the link and find out in the answers section if you can find your solution. – SolveProblem Aug 27 '18 at 07:48

1 Answers1

1
Start the MySQL server instance
$ mysqld --skip-grant-tables

Execute these statements.
$ mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;


$ /etc/init.d/mysql restart


$ mysql -u root -p with new password