{"id":6405,"date":"2016-11-04T23:52:17","date_gmt":"2016-11-04T15:52:17","guid":{"rendered":"http:\/\/rmohan.com\/?p=6405"},"modified":"2016-11-04T23:52:17","modified_gmt":"2016-11-04T15:52:17","slug":"error-1045-28000-access-denied-for-user-rootlocalhost-using-passwordno","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6405","title":{"rendered":"ERROR 1045 (28000): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217; (using password:NO)"},"content":{"rendered":"<p>[root ~]# mysql -u root<br \/>\nERROR 1045 (28000): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217; (using password:NO)<br \/>\nStop the service\/daemon of mysql running<br \/>\n[root ~]# service mysql stop<br \/>\nmysql stop\/waiting<br \/>\nStart mysql without any privileges using the following option; This option is used to boot up and do not use the privilege system of MySQL.<br \/>\n[root ~]# mysqld_safe &#8211;skip-grant-tables &amp;<br \/>\nenter the mysql command prompt<br \/>\n[root ~]# mysql -u root<br \/>\nmysql&gt;<br \/>\nFix the permission setting of the root user ;<br \/>\nmysql&gt; use mysql;<br \/>\nDatabase changed<br \/>\nmysql&gt; select * from user;<br \/>\nEmpty set (0.00 sec)<br \/>\nmysql&gt; truncate table user;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<br \/>\nmysql&gt; flush privileges;<br \/>\nQuery OK, 0 rows affected (0.01 sec)<br \/>\nmysql&gt; grant all privileges on *.* to root@localhost identified by &#8216;YourNewPassword&#8217; with grant option;<br \/>\nQuery OK, 0 rows affected (0.01 sec)<br \/>\n*if you don`t want any password or rather an empty password<\/p>\n<p>mysql&gt; grant all privileges on *.* to root@localhost identified by &#8221; with grant option;<br \/>\nQuery OK, 0 rows affected (0.01 sec)*<br \/>\nmysql&gt; flush privileges;<br \/>\nQuery OK, 0 rows affected (0.00 sec)<br \/>\nConfirm the results:<\/p>\n<p>mysql&gt; select host, user from user;<br \/>\n+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+<br \/>\n| host | user |<br \/>\n+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+<br \/>\n| localhost | root |<br \/>\n+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+<br \/>\n1 row in set (0.00 sec)<br \/>\nExit the shell and restart mysql in normal mode.<br \/>\nmysql&gt; quit;<br \/>\n[root ~]# kill -KILL [PID of mysqld_safe]<br \/>\n[root ~]# kill -KILL [PID of mysqld]<br \/>\n[root ~]# service mysql start<br \/>\nNow you can successfully login as root user with the password you set<br \/>\n[root ~]# mysql -u root -pYourNewPassword<br \/>\nmysql&gt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[root ~]# mysql -u root ERROR 1045 (28000): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217; (using password:NO) Stop the service\/daemon of mysql running [root ~]# service mysql stop mysql stop\/waiting Start mysql without any privileges using the following option; This option is used to boot up and do not use the privilege system of MySQL. [root ~]# [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6405"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6405"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6405\/revisions"}],"predecessor-version":[{"id":6406,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6405\/revisions\/6406"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6405"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6405"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6405"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}