Mysql fixing root password





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I guess I messed up the user table trying to update the password running something like



UPDATE mysql.user SET authentication_string='root' WHERE User='root';


without flushing privileges. Now I'm basically locked out and I cannot connect to mysql cli even if I try



sudo mysqld_safe --skip-grant-tables &


There is a way I can safely remove all mysql databases including user table?



(MacOS mojave)



This is the content of /usr/local/bin related to mysql



mysql               mysqladmin          mysqlpump
mysql.server mysqlbinlog mysqlrouter
mysql_client_test mysqlcheck mysqlrouter_plugin_info
mysql_config mysqld mysqlshow
mysql_config_editor mysqld_multi mysqlslap
mysql_secure_installation mysqld_safe mysqltest
mysql_ssl_rsa_setup mysqldump mysqlxtest
mysql_tzinfo_to_sql mysqldumpslow
mysql_upgrade mysqlimport









share|improve this question































    1















    I guess I messed up the user table trying to update the password running something like



    UPDATE mysql.user SET authentication_string='root' WHERE User='root';


    without flushing privileges. Now I'm basically locked out and I cannot connect to mysql cli even if I try



    sudo mysqld_safe --skip-grant-tables &


    There is a way I can safely remove all mysql databases including user table?



    (MacOS mojave)



    This is the content of /usr/local/bin related to mysql



    mysql               mysqladmin          mysqlpump
    mysql.server mysqlbinlog mysqlrouter
    mysql_client_test mysqlcheck mysqlrouter_plugin_info
    mysql_config mysqld mysqlshow
    mysql_config_editor mysqld_multi mysqlslap
    mysql_secure_installation mysqld_safe mysqltest
    mysql_ssl_rsa_setup mysqldump mysqlxtest
    mysql_tzinfo_to_sql mysqldumpslow
    mysql_upgrade mysqlimport









    share|improve this question



























      1












      1








      1








      I guess I messed up the user table trying to update the password running something like



      UPDATE mysql.user SET authentication_string='root' WHERE User='root';


      without flushing privileges. Now I'm basically locked out and I cannot connect to mysql cli even if I try



      sudo mysqld_safe --skip-grant-tables &


      There is a way I can safely remove all mysql databases including user table?



      (MacOS mojave)



      This is the content of /usr/local/bin related to mysql



      mysql               mysqladmin          mysqlpump
      mysql.server mysqlbinlog mysqlrouter
      mysql_client_test mysqlcheck mysqlrouter_plugin_info
      mysql_config mysqld mysqlshow
      mysql_config_editor mysqld_multi mysqlslap
      mysql_secure_installation mysqld_safe mysqltest
      mysql_ssl_rsa_setup mysqldump mysqlxtest
      mysql_tzinfo_to_sql mysqldumpslow
      mysql_upgrade mysqlimport









      share|improve this question
















      I guess I messed up the user table trying to update the password running something like



      UPDATE mysql.user SET authentication_string='root' WHERE User='root';


      without flushing privileges. Now I'm basically locked out and I cannot connect to mysql cli even if I try



      sudo mysqld_safe --skip-grant-tables &


      There is a way I can safely remove all mysql databases including user table?



      (MacOS mojave)



      This is the content of /usr/local/bin related to mysql



      mysql               mysqladmin          mysqlpump
      mysql.server mysqlbinlog mysqlrouter
      mysql_client_test mysqlcheck mysqlrouter_plugin_info
      mysql_config mysqld mysqlshow
      mysql_config_editor mysqld_multi mysqlslap
      mysql_secure_installation mysqld_safe mysqltest
      mysql_ssl_rsa_setup mysqldump mysqlxtest
      mysql_tzinfo_to_sql mysqldumpslow
      mysql_upgrade mysqlimport






      mac-osx






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 48 mins ago







      alfredopacino

















      asked 1 hour ago









      alfredopacinoalfredopacino

      118116




      118116






















          2 Answers
          2






          active

          oldest

          votes


















          2














          First backup your /etc/mysql and /var/lib/mysql directories.



          Then try to initalize



          mysql_install_db


          to recreate the mysql schema from scratch.



          You can read about it here: https://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html






          share|improve this answer








          New contributor




          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















          • I do not have both those dirs. And I get command not found launching mysql_install_db. It is a fresh installation I don't have any db I have to save. I don't mind wiping up the whole mysql installation. But I'm not clear what to do other than uninstall using brew

            – alfredopacino
            54 mins ago













          • what whereis mysql says?

            – Comar
            53 mins ago











          • which mysql prints /usr/local/bin/mysql (whereis prints nothing)

            – alfredopacino
            51 mins ago











          • Ah, my mistake, I have confused OS. Look for mysql configuration, binaries and files somewhere inside /usr/local, you may try to use locate mysql for this job.

            – Comar
            48 mins ago













          • I edited the question with my mysql bins in /usr/local/bin if it helps

            – alfredopacino
            46 mins ago



















          0














          You could simply uninstall mysql and purge configuration files if you don't need the databases or any settings.



          The steps would be:



          brew uninstall mysql
          brew cleanup
          sudo rm -rf /usr/local/var/mysql ## verify within my.cnf


          ps. Take this with a grain of salt, as I'm not a MacOS user.






          share|improve this answer
























          • I would avoid mess up the whole sistem, I will search around a little bit. macOS it's a f nightmare...

            – alfredopacino
            39 mins ago













          • ok even removing /usr/local/var/mysql didn't solved..

            – alfredopacino
            33 mins ago












          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "2"
          };
          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%2fserverfault.com%2fquestions%2f964975%2fmysql-fixing-root-password%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          First backup your /etc/mysql and /var/lib/mysql directories.



          Then try to initalize



          mysql_install_db


          to recreate the mysql schema from scratch.



          You can read about it here: https://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html






          share|improve this answer








          New contributor




          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















          • I do not have both those dirs. And I get command not found launching mysql_install_db. It is a fresh installation I don't have any db I have to save. I don't mind wiping up the whole mysql installation. But I'm not clear what to do other than uninstall using brew

            – alfredopacino
            54 mins ago













          • what whereis mysql says?

            – Comar
            53 mins ago











          • which mysql prints /usr/local/bin/mysql (whereis prints nothing)

            – alfredopacino
            51 mins ago











          • Ah, my mistake, I have confused OS. Look for mysql configuration, binaries and files somewhere inside /usr/local, you may try to use locate mysql for this job.

            – Comar
            48 mins ago













          • I edited the question with my mysql bins in /usr/local/bin if it helps

            – alfredopacino
            46 mins ago
















          2














          First backup your /etc/mysql and /var/lib/mysql directories.



          Then try to initalize



          mysql_install_db


          to recreate the mysql schema from scratch.



          You can read about it here: https://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html






          share|improve this answer








          New contributor




          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





















          • I do not have both those dirs. And I get command not found launching mysql_install_db. It is a fresh installation I don't have any db I have to save. I don't mind wiping up the whole mysql installation. But I'm not clear what to do other than uninstall using brew

            – alfredopacino
            54 mins ago













          • what whereis mysql says?

            – Comar
            53 mins ago











          • which mysql prints /usr/local/bin/mysql (whereis prints nothing)

            – alfredopacino
            51 mins ago











          • Ah, my mistake, I have confused OS. Look for mysql configuration, binaries and files somewhere inside /usr/local, you may try to use locate mysql for this job.

            – Comar
            48 mins ago













          • I edited the question with my mysql bins in /usr/local/bin if it helps

            – alfredopacino
            46 mins ago














          2












          2








          2







          First backup your /etc/mysql and /var/lib/mysql directories.



          Then try to initalize



          mysql_install_db


          to recreate the mysql schema from scratch.



          You can read about it here: https://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html






          share|improve this answer








          New contributor




          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.










          First backup your /etc/mysql and /var/lib/mysql directories.



          Then try to initalize



          mysql_install_db


          to recreate the mysql schema from scratch.



          You can read about it here: https://dev.mysql.com/doc/refman/5.6/en/mysql-install-db.html







          share|improve this answer








          New contributor




          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          share|improve this answer



          share|improve this answer






          New contributor




          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.









          answered 58 mins ago









          ComarComar

          813




          813




          New contributor




          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.





          New contributor





          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.






          Comar is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
          Check out our Code of Conduct.













          • I do not have both those dirs. And I get command not found launching mysql_install_db. It is a fresh installation I don't have any db I have to save. I don't mind wiping up the whole mysql installation. But I'm not clear what to do other than uninstall using brew

            – alfredopacino
            54 mins ago













          • what whereis mysql says?

            – Comar
            53 mins ago











          • which mysql prints /usr/local/bin/mysql (whereis prints nothing)

            – alfredopacino
            51 mins ago











          • Ah, my mistake, I have confused OS. Look for mysql configuration, binaries and files somewhere inside /usr/local, you may try to use locate mysql for this job.

            – Comar
            48 mins ago













          • I edited the question with my mysql bins in /usr/local/bin if it helps

            – alfredopacino
            46 mins ago



















          • I do not have both those dirs. And I get command not found launching mysql_install_db. It is a fresh installation I don't have any db I have to save. I don't mind wiping up the whole mysql installation. But I'm not clear what to do other than uninstall using brew

            – alfredopacino
            54 mins ago













          • what whereis mysql says?

            – Comar
            53 mins ago











          • which mysql prints /usr/local/bin/mysql (whereis prints nothing)

            – alfredopacino
            51 mins ago











          • Ah, my mistake, I have confused OS. Look for mysql configuration, binaries and files somewhere inside /usr/local, you may try to use locate mysql for this job.

            – Comar
            48 mins ago













          • I edited the question with my mysql bins in /usr/local/bin if it helps

            – alfredopacino
            46 mins ago

















          I do not have both those dirs. And I get command not found launching mysql_install_db. It is a fresh installation I don't have any db I have to save. I don't mind wiping up the whole mysql installation. But I'm not clear what to do other than uninstall using brew

          – alfredopacino
          54 mins ago







          I do not have both those dirs. And I get command not found launching mysql_install_db. It is a fresh installation I don't have any db I have to save. I don't mind wiping up the whole mysql installation. But I'm not clear what to do other than uninstall using brew

          – alfredopacino
          54 mins ago















          what whereis mysql says?

          – Comar
          53 mins ago





          what whereis mysql says?

          – Comar
          53 mins ago













          which mysql prints /usr/local/bin/mysql (whereis prints nothing)

          – alfredopacino
          51 mins ago





          which mysql prints /usr/local/bin/mysql (whereis prints nothing)

          – alfredopacino
          51 mins ago













          Ah, my mistake, I have confused OS. Look for mysql configuration, binaries and files somewhere inside /usr/local, you may try to use locate mysql for this job.

          – Comar
          48 mins ago







          Ah, my mistake, I have confused OS. Look for mysql configuration, binaries and files somewhere inside /usr/local, you may try to use locate mysql for this job.

          – Comar
          48 mins ago















          I edited the question with my mysql bins in /usr/local/bin if it helps

          – alfredopacino
          46 mins ago





          I edited the question with my mysql bins in /usr/local/bin if it helps

          – alfredopacino
          46 mins ago













          0














          You could simply uninstall mysql and purge configuration files if you don't need the databases or any settings.



          The steps would be:



          brew uninstall mysql
          brew cleanup
          sudo rm -rf /usr/local/var/mysql ## verify within my.cnf


          ps. Take this with a grain of salt, as I'm not a MacOS user.






          share|improve this answer
























          • I would avoid mess up the whole sistem, I will search around a little bit. macOS it's a f nightmare...

            – alfredopacino
            39 mins ago













          • ok even removing /usr/local/var/mysql didn't solved..

            – alfredopacino
            33 mins ago
















          0














          You could simply uninstall mysql and purge configuration files if you don't need the databases or any settings.



          The steps would be:



          brew uninstall mysql
          brew cleanup
          sudo rm -rf /usr/local/var/mysql ## verify within my.cnf


          ps. Take this with a grain of salt, as I'm not a MacOS user.






          share|improve this answer
























          • I would avoid mess up the whole sistem, I will search around a little bit. macOS it's a f nightmare...

            – alfredopacino
            39 mins ago













          • ok even removing /usr/local/var/mysql didn't solved..

            – alfredopacino
            33 mins ago














          0












          0








          0







          You could simply uninstall mysql and purge configuration files if you don't need the databases or any settings.



          The steps would be:



          brew uninstall mysql
          brew cleanup
          sudo rm -rf /usr/local/var/mysql ## verify within my.cnf


          ps. Take this with a grain of salt, as I'm not a MacOS user.






          share|improve this answer













          You could simply uninstall mysql and purge configuration files if you don't need the databases or any settings.



          The steps would be:



          brew uninstall mysql
          brew cleanup
          sudo rm -rf /usr/local/var/mysql ## verify within my.cnf


          ps. Take this with a grain of salt, as I'm not a MacOS user.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 44 mins ago









          LeoLeo

          1,430415




          1,430415













          • I would avoid mess up the whole sistem, I will search around a little bit. macOS it's a f nightmare...

            – alfredopacino
            39 mins ago













          • ok even removing /usr/local/var/mysql didn't solved..

            – alfredopacino
            33 mins ago



















          • I would avoid mess up the whole sistem, I will search around a little bit. macOS it's a f nightmare...

            – alfredopacino
            39 mins ago













          • ok even removing /usr/local/var/mysql didn't solved..

            – alfredopacino
            33 mins ago

















          I would avoid mess up the whole sistem, I will search around a little bit. macOS it's a f nightmare...

          – alfredopacino
          39 mins ago







          I would avoid mess up the whole sistem, I will search around a little bit. macOS it's a f nightmare...

          – alfredopacino
          39 mins ago















          ok even removing /usr/local/var/mysql didn't solved..

          – alfredopacino
          33 mins ago





          ok even removing /usr/local/var/mysql didn't solved..

          – alfredopacino
          33 mins ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Server Fault!


          • 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%2fserverfault.com%2fquestions%2f964975%2fmysql-fixing-root-password%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