Access denied for user 'root'@'localhost' (using password: YES) EVEN when the Password works on PhpMyAdmin












1















I have an issue with accessing MySQL using root and password.
I am trying to connect the Server using PuTTY SSH using



> mysql u root -p


For an unknown reason I can NOT access the Database and I am getting rejected with the following ERROR:



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


The weird thing is that I am using the same password with PhpMyAdmin using Web and I can access everything. I need to run a script that will allow the SQL server




root@localhost user




run the query over the LAN and not the web.



Therefore I need the user to connect using command line SSH or something like that.



How can I fix that issue? the user rott and password WORKS just fine through PhpMyAdmin and not through SSH PuTTY, Why?



Is there something I need to do in order to fix this? I have been working with the Database for 2 years now using the web interface. Now I need to have it working using SSH (22).



Please assist.
thanks in advance.
Arye










share|improve this question























  • Does mysql u root -p user work ?

    – Michael Durrant
    Jun 16 '15 at 14:30











  • Also see dev.mysql.com/doc/refman/5.1/en/problems-connecting.html

    – Michael Durrant
    Jun 16 '15 at 14:34











  • What happens when you try mysql -h 127.0.0.1 -u root -p ? (when no host is specified or 'localhost' is used, then mysql will try to connect over a filesystem socket - and these usually have different authentication rules associated compared with network sockets)

    – symcbean
    Jun 16 '15 at 15:16
















1















I have an issue with accessing MySQL using root and password.
I am trying to connect the Server using PuTTY SSH using



> mysql u root -p


For an unknown reason I can NOT access the Database and I am getting rejected with the following ERROR:



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


The weird thing is that I am using the same password with PhpMyAdmin using Web and I can access everything. I need to run a script that will allow the SQL server




root@localhost user




run the query over the LAN and not the web.



Therefore I need the user to connect using command line SSH or something like that.



How can I fix that issue? the user rott and password WORKS just fine through PhpMyAdmin and not through SSH PuTTY, Why?



Is there something I need to do in order to fix this? I have been working with the Database for 2 years now using the web interface. Now I need to have it working using SSH (22).



Please assist.
thanks in advance.
Arye










share|improve this question























  • Does mysql u root -p user work ?

    – Michael Durrant
    Jun 16 '15 at 14:30











  • Also see dev.mysql.com/doc/refman/5.1/en/problems-connecting.html

    – Michael Durrant
    Jun 16 '15 at 14:34











  • What happens when you try mysql -h 127.0.0.1 -u root -p ? (when no host is specified or 'localhost' is used, then mysql will try to connect over a filesystem socket - and these usually have different authentication rules associated compared with network sockets)

    – symcbean
    Jun 16 '15 at 15:16














1












1








1








I have an issue with accessing MySQL using root and password.
I am trying to connect the Server using PuTTY SSH using



> mysql u root -p


For an unknown reason I can NOT access the Database and I am getting rejected with the following ERROR:



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


The weird thing is that I am using the same password with PhpMyAdmin using Web and I can access everything. I need to run a script that will allow the SQL server




root@localhost user




run the query over the LAN and not the web.



Therefore I need the user to connect using command line SSH or something like that.



How can I fix that issue? the user rott and password WORKS just fine through PhpMyAdmin and not through SSH PuTTY, Why?



Is there something I need to do in order to fix this? I have been working with the Database for 2 years now using the web interface. Now I need to have it working using SSH (22).



Please assist.
thanks in advance.
Arye










share|improve this question














I have an issue with accessing MySQL using root and password.
I am trying to connect the Server using PuTTY SSH using



> mysql u root -p


For an unknown reason I can NOT access the Database and I am getting rejected with the following ERROR:



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


The weird thing is that I am using the same password with PhpMyAdmin using Web and I can access everything. I need to run a script that will allow the SQL server




root@localhost user




run the query over the LAN and not the web.



Therefore I need the user to connect using command line SSH or something like that.



How can I fix that issue? the user rott and password WORKS just fine through PhpMyAdmin and not through SSH PuTTY, Why?



Is there something I need to do in order to fix this? I have been working with the Database for 2 years now using the web interface. Now I need to have it working using SSH (22).



Please assist.
thanks in advance.
Arye







mysql ssh phpmyadmin root putty






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jun 16 '15 at 14:26









Arye GuettaArye Guetta

258




258













  • Does mysql u root -p user work ?

    – Michael Durrant
    Jun 16 '15 at 14:30











  • Also see dev.mysql.com/doc/refman/5.1/en/problems-connecting.html

    – Michael Durrant
    Jun 16 '15 at 14:34











  • What happens when you try mysql -h 127.0.0.1 -u root -p ? (when no host is specified or 'localhost' is used, then mysql will try to connect over a filesystem socket - and these usually have different authentication rules associated compared with network sockets)

    – symcbean
    Jun 16 '15 at 15:16



















  • Does mysql u root -p user work ?

    – Michael Durrant
    Jun 16 '15 at 14:30











  • Also see dev.mysql.com/doc/refman/5.1/en/problems-connecting.html

    – Michael Durrant
    Jun 16 '15 at 14:34











  • What happens when you try mysql -h 127.0.0.1 -u root -p ? (when no host is specified or 'localhost' is used, then mysql will try to connect over a filesystem socket - and these usually have different authentication rules associated compared with network sockets)

    – symcbean
    Jun 16 '15 at 15:16

















Does mysql u root -p user work ?

– Michael Durrant
Jun 16 '15 at 14:30





Does mysql u root -p user work ?

– Michael Durrant
Jun 16 '15 at 14:30













Also see dev.mysql.com/doc/refman/5.1/en/problems-connecting.html

– Michael Durrant
Jun 16 '15 at 14:34





Also see dev.mysql.com/doc/refman/5.1/en/problems-connecting.html

– Michael Durrant
Jun 16 '15 at 14:34













What happens when you try mysql -h 127.0.0.1 -u root -p ? (when no host is specified or 'localhost' is used, then mysql will try to connect over a filesystem socket - and these usually have different authentication rules associated compared with network sockets)

– symcbean
Jun 16 '15 at 15:16





What happens when you try mysql -h 127.0.0.1 -u root -p ? (when no host is specified or 'localhost' is used, then mysql will try to connect over a filesystem socket - and these usually have different authentication rules associated compared with network sockets)

– symcbean
Jun 16 '15 at 15:16












3 Answers
3






active

oldest

votes


















0














It sounds like you need to update the your password for root on MySQL.
Check here: MySQL - ERROR 1045 - Access denied






share|improve this answer


























  • I am not sure I am following what you want me to do? the password is working on PhpMyAdmin and been like that for two years now. I CAN access the DB from the web BUT NOT from the SSH command line.

    – Arye Guetta
    Jun 16 '15 at 14:35













  • Since you are getting denied. You should make sure that your root credentials through MySQL are set up correctly. The link has some good information on checking that.

    – Grant P
    Jun 16 '15 at 14:39











  • Thanks. this is my work Server and I don't want to NOT be able to connect to SQL any longer. Whould that effect my access of root in the web? Since if I do that and I will lose the access to the server, then what would I do?

    – Arye Guetta
    Jun 16 '15 at 14:55











  • I am not sure if I understand what you mean. MySQL is just a program that runs on your server. Flushing/changing credentials for it will not affect your root credentials for other programs on your server or your access to your server as a whole. Just for security/data access reasons, MySQL maintains its own set of user credentials for people that access the DB. E.g. you may only want to give some non-root user readonly privileges.

    – Grant P
    Jun 16 '15 at 15:01











  • When you run mysql u root -p, you are running a script that is trying to automatically log you into MySQL using whatever password it has saved. That password is not necessarily the correct one which appears to be the case here. You say PhpMyAdmin is able to connect, so check what password you have saved for root there and then set the root password for MySQL to match.

    – Grant P
    Jun 16 '15 at 15:05



















0














Thank you all for your help. I have managed to overcome the issue: (see below)



That was FIXED Only when I changed from old password to new. in my.cnf file I have removed the flag for old_password=1 and Restart the service of MySQL.



Then I have created a NEW password (using the old one I had) and it was created with 41 (NEW) Hash length and not 16 (OLD)..



Then I did flush privileges as you recommended - and IT WORKS.
Thank You!






share|improve this answer































    0














    > mysql -h your_host_name -P your_port_number -u your_user_name -p


    try with hostname option it should work!






    share|improve this answer
























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      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',
      autoActivateHeartbeat: false,
      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%2fstackoverflow.com%2fquestions%2f30870495%2faccess-denied-for-user-rootlocalhost-using-password-yes-even-when-the-pa%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









      0














      It sounds like you need to update the your password for root on MySQL.
      Check here: MySQL - ERROR 1045 - Access denied






      share|improve this answer


























      • I am not sure I am following what you want me to do? the password is working on PhpMyAdmin and been like that for two years now. I CAN access the DB from the web BUT NOT from the SSH command line.

        – Arye Guetta
        Jun 16 '15 at 14:35













      • Since you are getting denied. You should make sure that your root credentials through MySQL are set up correctly. The link has some good information on checking that.

        – Grant P
        Jun 16 '15 at 14:39











      • Thanks. this is my work Server and I don't want to NOT be able to connect to SQL any longer. Whould that effect my access of root in the web? Since if I do that and I will lose the access to the server, then what would I do?

        – Arye Guetta
        Jun 16 '15 at 14:55











      • I am not sure if I understand what you mean. MySQL is just a program that runs on your server. Flushing/changing credentials for it will not affect your root credentials for other programs on your server or your access to your server as a whole. Just for security/data access reasons, MySQL maintains its own set of user credentials for people that access the DB. E.g. you may only want to give some non-root user readonly privileges.

        – Grant P
        Jun 16 '15 at 15:01











      • When you run mysql u root -p, you are running a script that is trying to automatically log you into MySQL using whatever password it has saved. That password is not necessarily the correct one which appears to be the case here. You say PhpMyAdmin is able to connect, so check what password you have saved for root there and then set the root password for MySQL to match.

        – Grant P
        Jun 16 '15 at 15:05
















      0














      It sounds like you need to update the your password for root on MySQL.
      Check here: MySQL - ERROR 1045 - Access denied






      share|improve this answer


























      • I am not sure I am following what you want me to do? the password is working on PhpMyAdmin and been like that for two years now. I CAN access the DB from the web BUT NOT from the SSH command line.

        – Arye Guetta
        Jun 16 '15 at 14:35













      • Since you are getting denied. You should make sure that your root credentials through MySQL are set up correctly. The link has some good information on checking that.

        – Grant P
        Jun 16 '15 at 14:39











      • Thanks. this is my work Server and I don't want to NOT be able to connect to SQL any longer. Whould that effect my access of root in the web? Since if I do that and I will lose the access to the server, then what would I do?

        – Arye Guetta
        Jun 16 '15 at 14:55











      • I am not sure if I understand what you mean. MySQL is just a program that runs on your server. Flushing/changing credentials for it will not affect your root credentials for other programs on your server or your access to your server as a whole. Just for security/data access reasons, MySQL maintains its own set of user credentials for people that access the DB. E.g. you may only want to give some non-root user readonly privileges.

        – Grant P
        Jun 16 '15 at 15:01











      • When you run mysql u root -p, you are running a script that is trying to automatically log you into MySQL using whatever password it has saved. That password is not necessarily the correct one which appears to be the case here. You say PhpMyAdmin is able to connect, so check what password you have saved for root there and then set the root password for MySQL to match.

        – Grant P
        Jun 16 '15 at 15:05














      0












      0








      0







      It sounds like you need to update the your password for root on MySQL.
      Check here: MySQL - ERROR 1045 - Access denied






      share|improve this answer















      It sounds like you need to update the your password for root on MySQL.
      Check here: MySQL - ERROR 1045 - Access denied







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 23 '17 at 12:15









      Community

      11




      11










      answered Jun 16 '15 at 14:33









      Grant PGrant P

      456




      456













      • I am not sure I am following what you want me to do? the password is working on PhpMyAdmin and been like that for two years now. I CAN access the DB from the web BUT NOT from the SSH command line.

        – Arye Guetta
        Jun 16 '15 at 14:35













      • Since you are getting denied. You should make sure that your root credentials through MySQL are set up correctly. The link has some good information on checking that.

        – Grant P
        Jun 16 '15 at 14:39











      • Thanks. this is my work Server and I don't want to NOT be able to connect to SQL any longer. Whould that effect my access of root in the web? Since if I do that and I will lose the access to the server, then what would I do?

        – Arye Guetta
        Jun 16 '15 at 14:55











      • I am not sure if I understand what you mean. MySQL is just a program that runs on your server. Flushing/changing credentials for it will not affect your root credentials for other programs on your server or your access to your server as a whole. Just for security/data access reasons, MySQL maintains its own set of user credentials for people that access the DB. E.g. you may only want to give some non-root user readonly privileges.

        – Grant P
        Jun 16 '15 at 15:01











      • When you run mysql u root -p, you are running a script that is trying to automatically log you into MySQL using whatever password it has saved. That password is not necessarily the correct one which appears to be the case here. You say PhpMyAdmin is able to connect, so check what password you have saved for root there and then set the root password for MySQL to match.

        – Grant P
        Jun 16 '15 at 15:05



















      • I am not sure I am following what you want me to do? the password is working on PhpMyAdmin and been like that for two years now. I CAN access the DB from the web BUT NOT from the SSH command line.

        – Arye Guetta
        Jun 16 '15 at 14:35













      • Since you are getting denied. You should make sure that your root credentials through MySQL are set up correctly. The link has some good information on checking that.

        – Grant P
        Jun 16 '15 at 14:39











      • Thanks. this is my work Server and I don't want to NOT be able to connect to SQL any longer. Whould that effect my access of root in the web? Since if I do that and I will lose the access to the server, then what would I do?

        – Arye Guetta
        Jun 16 '15 at 14:55











      • I am not sure if I understand what you mean. MySQL is just a program that runs on your server. Flushing/changing credentials for it will not affect your root credentials for other programs on your server or your access to your server as a whole. Just for security/data access reasons, MySQL maintains its own set of user credentials for people that access the DB. E.g. you may only want to give some non-root user readonly privileges.

        – Grant P
        Jun 16 '15 at 15:01











      • When you run mysql u root -p, you are running a script that is trying to automatically log you into MySQL using whatever password it has saved. That password is not necessarily the correct one which appears to be the case here. You say PhpMyAdmin is able to connect, so check what password you have saved for root there and then set the root password for MySQL to match.

        – Grant P
        Jun 16 '15 at 15:05

















      I am not sure I am following what you want me to do? the password is working on PhpMyAdmin and been like that for two years now. I CAN access the DB from the web BUT NOT from the SSH command line.

      – Arye Guetta
      Jun 16 '15 at 14:35







      I am not sure I am following what you want me to do? the password is working on PhpMyAdmin and been like that for two years now. I CAN access the DB from the web BUT NOT from the SSH command line.

      – Arye Guetta
      Jun 16 '15 at 14:35















      Since you are getting denied. You should make sure that your root credentials through MySQL are set up correctly. The link has some good information on checking that.

      – Grant P
      Jun 16 '15 at 14:39





      Since you are getting denied. You should make sure that your root credentials through MySQL are set up correctly. The link has some good information on checking that.

      – Grant P
      Jun 16 '15 at 14:39













      Thanks. this is my work Server and I don't want to NOT be able to connect to SQL any longer. Whould that effect my access of root in the web? Since if I do that and I will lose the access to the server, then what would I do?

      – Arye Guetta
      Jun 16 '15 at 14:55





      Thanks. this is my work Server and I don't want to NOT be able to connect to SQL any longer. Whould that effect my access of root in the web? Since if I do that and I will lose the access to the server, then what would I do?

      – Arye Guetta
      Jun 16 '15 at 14:55













      I am not sure if I understand what you mean. MySQL is just a program that runs on your server. Flushing/changing credentials for it will not affect your root credentials for other programs on your server or your access to your server as a whole. Just for security/data access reasons, MySQL maintains its own set of user credentials for people that access the DB. E.g. you may only want to give some non-root user readonly privileges.

      – Grant P
      Jun 16 '15 at 15:01





      I am not sure if I understand what you mean. MySQL is just a program that runs on your server. Flushing/changing credentials for it will not affect your root credentials for other programs on your server or your access to your server as a whole. Just for security/data access reasons, MySQL maintains its own set of user credentials for people that access the DB. E.g. you may only want to give some non-root user readonly privileges.

      – Grant P
      Jun 16 '15 at 15:01













      When you run mysql u root -p, you are running a script that is trying to automatically log you into MySQL using whatever password it has saved. That password is not necessarily the correct one which appears to be the case here. You say PhpMyAdmin is able to connect, so check what password you have saved for root there and then set the root password for MySQL to match.

      – Grant P
      Jun 16 '15 at 15:05





      When you run mysql u root -p, you are running a script that is trying to automatically log you into MySQL using whatever password it has saved. That password is not necessarily the correct one which appears to be the case here. You say PhpMyAdmin is able to connect, so check what password you have saved for root there and then set the root password for MySQL to match.

      – Grant P
      Jun 16 '15 at 15:05













      0














      Thank you all for your help. I have managed to overcome the issue: (see below)



      That was FIXED Only when I changed from old password to new. in my.cnf file I have removed the flag for old_password=1 and Restart the service of MySQL.



      Then I have created a NEW password (using the old one I had) and it was created with 41 (NEW) Hash length and not 16 (OLD)..



      Then I did flush privileges as you recommended - and IT WORKS.
      Thank You!






      share|improve this answer




























        0














        Thank you all for your help. I have managed to overcome the issue: (see below)



        That was FIXED Only when I changed from old password to new. in my.cnf file I have removed the flag for old_password=1 and Restart the service of MySQL.



        Then I have created a NEW password (using the old one I had) and it was created with 41 (NEW) Hash length and not 16 (OLD)..



        Then I did flush privileges as you recommended - and IT WORKS.
        Thank You!






        share|improve this answer


























          0












          0








          0







          Thank you all for your help. I have managed to overcome the issue: (see below)



          That was FIXED Only when I changed from old password to new. in my.cnf file I have removed the flag for old_password=1 and Restart the service of MySQL.



          Then I have created a NEW password (using the old one I had) and it was created with 41 (NEW) Hash length and not 16 (OLD)..



          Then I did flush privileges as you recommended - and IT WORKS.
          Thank You!






          share|improve this answer













          Thank you all for your help. I have managed to overcome the issue: (see below)



          That was FIXED Only when I changed from old password to new. in my.cnf file I have removed the flag for old_password=1 and Restart the service of MySQL.



          Then I have created a NEW password (using the old one I had) and it was created with 41 (NEW) Hash length and not 16 (OLD)..



          Then I did flush privileges as you recommended - and IT WORKS.
          Thank You!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jul 19 '15 at 9:11









          Arye GuettaArye Guetta

          258




          258























              0














              > mysql -h your_host_name -P your_port_number -u your_user_name -p


              try with hostname option it should work!






              share|improve this answer




























                0














                > mysql -h your_host_name -P your_port_number -u your_user_name -p


                try with hostname option it should work!






                share|improve this answer


























                  0












                  0








                  0







                  > mysql -h your_host_name -P your_port_number -u your_user_name -p


                  try with hostname option it should work!






                  share|improve this answer













                  > mysql -h your_host_name -P your_port_number -u your_user_name -p


                  try with hostname option it should work!







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 16 '18 at 9:21









                  Atul BaldaniyaAtul Baldaniya

                  3618




                  3618






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • 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%2fstackoverflow.com%2fquestions%2f30870495%2faccess-denied-for-user-rootlocalhost-using-password-yes-even-when-the-pa%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

                      Florida Star v. B. J. F.

                      Danny Elfman

                      Lugert, Oklahoma