#1698 - Access denied for user 'root'@'localhost' mysql -5.7 and ubuntu-16.04











up vote
3
down vote

favorite
5












I am getting below error while logged into the phpmyadmin.



it is not a fresh installation.



I have also tried login through the command line.



1.



mysql -u root -p

**error :** ERROR 1698 (28000): Access denied for user 'root'@'localhost'


2.



sudo mysql -u root -p


I am successfully login into mysql using above command.



but not with case 1.



Mysql details:
username : root
password :









share|improve this question




















  • 1




    this SO Q&A should solve your problem
    – Yaron
    Jan 23 at 7:58






  • 1




    @yaron thank you for the solution
    – prashanth padala
    Jan 23 at 8:04















up vote
3
down vote

favorite
5












I am getting below error while logged into the phpmyadmin.



it is not a fresh installation.



I have also tried login through the command line.



1.



mysql -u root -p

**error :** ERROR 1698 (28000): Access denied for user 'root'@'localhost'


2.



sudo mysql -u root -p


I am successfully login into mysql using above command.



but not with case 1.



Mysql details:
username : root
password :









share|improve this question




















  • 1




    this SO Q&A should solve your problem
    – Yaron
    Jan 23 at 7:58






  • 1




    @yaron thank you for the solution
    – prashanth padala
    Jan 23 at 8:04













up vote
3
down vote

favorite
5









up vote
3
down vote

favorite
5






5





I am getting below error while logged into the phpmyadmin.



it is not a fresh installation.



I have also tried login through the command line.



1.



mysql -u root -p

**error :** ERROR 1698 (28000): Access denied for user 'root'@'localhost'


2.



sudo mysql -u root -p


I am successfully login into mysql using above command.



but not with case 1.



Mysql details:
username : root
password :









share|improve this question















I am getting below error while logged into the phpmyadmin.



it is not a fresh installation.



I have also tried login through the command line.



1.



mysql -u root -p

**error :** ERROR 1698 (28000): Access denied for user 'root'@'localhost'


2.



sudo mysql -u root -p


I am successfully login into mysql using above command.



but not with case 1.



Mysql details:
username : root
password :






apache2 mysql phpmyadmin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 25 at 6:47

























asked Jan 23 at 7:48









prashanth padala

36248




36248








  • 1




    this SO Q&A should solve your problem
    – Yaron
    Jan 23 at 7:58






  • 1




    @yaron thank you for the solution
    – prashanth padala
    Jan 23 at 8:04














  • 1




    this SO Q&A should solve your problem
    – Yaron
    Jan 23 at 7:58






  • 1




    @yaron thank you for the solution
    – prashanth padala
    Jan 23 at 8:04








1




1




this SO Q&A should solve your problem
– Yaron
Jan 23 at 7:58




this SO Q&A should solve your problem
– Yaron
Jan 23 at 7:58




1




1




@yaron thank you for the solution
– prashanth padala
Jan 23 at 8:04




@yaron thank you for the solution
– prashanth padala
Jan 23 at 8:04










3 Answers
3






active

oldest

votes

















up vote
3
down vote













This is because MySQL by default use local system account to login as user root. This is done with plugin “unix_socket” or it might possible that password has been changed.



To allow MySQL user root to login to PhpMyAdmin, run following commands in MySQL command prompt



use mysql;
UPDATE user SET plugin='mysql_native_password' WHERE User='root';
FLUSH PRIVILEGES;
exit;


see PhpMyAdmin






share|improve this answer




























    up vote
    1
    down vote













    step 1. sudo mysql -u root -p



    step 2. USE mysql;



    step 3. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin';



    Here 'admin' is your new password, yo can change it.



    step 4. exit
    Thanks. You are done.






    share|improve this answer




























      up vote
      0
      down vote



      accepted










      I solved the above problem with setting the plugin value in user tables



      mysql> USE mysql;
      mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
      mysql> FLUSH PRIVILEGES;
      mysql> exit;

      $ service mysql restart





      share|improve this answer





















      • And how did you log in mysql to use the command USE mysql? This is catch 22.
        – Hrvoje T
        May 28 at 13:01










      • using this command sudo mysql -u root -p
        – prashanth padala
        May 28 at 15:46











      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f998920%2f1698-access-denied-for-user-rootlocalhost-mysql-5-7-and-ubuntu-16-04%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote













      This is because MySQL by default use local system account to login as user root. This is done with plugin “unix_socket” or it might possible that password has been changed.



      To allow MySQL user root to login to PhpMyAdmin, run following commands in MySQL command prompt



      use mysql;
      UPDATE user SET plugin='mysql_native_password' WHERE User='root';
      FLUSH PRIVILEGES;
      exit;


      see PhpMyAdmin






      share|improve this answer

























        up vote
        3
        down vote













        This is because MySQL by default use local system account to login as user root. This is done with plugin “unix_socket” or it might possible that password has been changed.



        To allow MySQL user root to login to PhpMyAdmin, run following commands in MySQL command prompt



        use mysql;
        UPDATE user SET plugin='mysql_native_password' WHERE User='root';
        FLUSH PRIVILEGES;
        exit;


        see PhpMyAdmin






        share|improve this answer























          up vote
          3
          down vote










          up vote
          3
          down vote









          This is because MySQL by default use local system account to login as user root. This is done with plugin “unix_socket” or it might possible that password has been changed.



          To allow MySQL user root to login to PhpMyAdmin, run following commands in MySQL command prompt



          use mysql;
          UPDATE user SET plugin='mysql_native_password' WHERE User='root';
          FLUSH PRIVILEGES;
          exit;


          see PhpMyAdmin






          share|improve this answer












          This is because MySQL by default use local system account to login as user root. This is done with plugin “unix_socket” or it might possible that password has been changed.



          To allow MySQL user root to login to PhpMyAdmin, run following commands in MySQL command prompt



          use mysql;
          UPDATE user SET plugin='mysql_native_password' WHERE User='root';
          FLUSH PRIVILEGES;
          exit;


          see PhpMyAdmin







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 24 at 9:08









          SagarVirpara

          311




          311
























              up vote
              1
              down vote













              step 1. sudo mysql -u root -p



              step 2. USE mysql;



              step 3. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin';



              Here 'admin' is your new password, yo can change it.



              step 4. exit
              Thanks. You are done.






              share|improve this answer

























                up vote
                1
                down vote













                step 1. sudo mysql -u root -p



                step 2. USE mysql;



                step 3. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin';



                Here 'admin' is your new password, yo can change it.



                step 4. exit
                Thanks. You are done.






                share|improve this answer























                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  step 1. sudo mysql -u root -p



                  step 2. USE mysql;



                  step 3. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin';



                  Here 'admin' is your new password, yo can change it.



                  step 4. exit
                  Thanks. You are done.






                  share|improve this answer












                  step 1. sudo mysql -u root -p



                  step 2. USE mysql;



                  step 3. ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin';



                  Here 'admin' is your new password, yo can change it.



                  step 4. exit
                  Thanks. You are done.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 1 at 10:58









                  Y. Joy

                  1113




                  1113






















                      up vote
                      0
                      down vote



                      accepted










                      I solved the above problem with setting the plugin value in user tables



                      mysql> USE mysql;
                      mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
                      mysql> FLUSH PRIVILEGES;
                      mysql> exit;

                      $ service mysql restart





                      share|improve this answer





















                      • And how did you log in mysql to use the command USE mysql? This is catch 22.
                        – Hrvoje T
                        May 28 at 13:01










                      • using this command sudo mysql -u root -p
                        – prashanth padala
                        May 28 at 15:46















                      up vote
                      0
                      down vote



                      accepted










                      I solved the above problem with setting the plugin value in user tables



                      mysql> USE mysql;
                      mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
                      mysql> FLUSH PRIVILEGES;
                      mysql> exit;

                      $ service mysql restart





                      share|improve this answer





















                      • And how did you log in mysql to use the command USE mysql? This is catch 22.
                        – Hrvoje T
                        May 28 at 13:01










                      • using this command sudo mysql -u root -p
                        – prashanth padala
                        May 28 at 15:46













                      up vote
                      0
                      down vote



                      accepted







                      up vote
                      0
                      down vote



                      accepted






                      I solved the above problem with setting the plugin value in user tables



                      mysql> USE mysql;
                      mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
                      mysql> FLUSH PRIVILEGES;
                      mysql> exit;

                      $ service mysql restart





                      share|improve this answer












                      I solved the above problem with setting the plugin value in user tables



                      mysql> USE mysql;
                      mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
                      mysql> FLUSH PRIVILEGES;
                      mysql> exit;

                      $ service mysql restart






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jan 24 at 8:38









                      prashanth padala

                      36248




                      36248












                      • And how did you log in mysql to use the command USE mysql? This is catch 22.
                        – Hrvoje T
                        May 28 at 13:01










                      • using this command sudo mysql -u root -p
                        – prashanth padala
                        May 28 at 15:46


















                      • And how did you log in mysql to use the command USE mysql? This is catch 22.
                        – Hrvoje T
                        May 28 at 13:01










                      • using this command sudo mysql -u root -p
                        – prashanth padala
                        May 28 at 15:46
















                      And how did you log in mysql to use the command USE mysql? This is catch 22.
                      – Hrvoje T
                      May 28 at 13:01




                      And how did you log in mysql to use the command USE mysql? This is catch 22.
                      – Hrvoje T
                      May 28 at 13:01












                      using this command sudo mysql -u root -p
                      – prashanth padala
                      May 28 at 15:46




                      using this command sudo mysql -u root -p
                      – prashanth padala
                      May 28 at 15:46


















                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f998920%2f1698-access-denied-for-user-rootlocalhost-mysql-5-7-and-ubuntu-16-04%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                      Mangá

                      Eduardo VII do Reino Unido