setting a mysql root password












0















I just installed mysql-server on Ubuntu 18.0.4.2 LTS and I can now connect to the server just fine when I do mysql but I can't connect when I do mysql -h127.0.0.1 -uroot -p.



When I logged in just now with mysql I did this:



SET PASSWORD = 'mypassword';


But that got me back this warning:



 SET PASSWORD has no significance for user 'root'@'localhost' as authentication plugin does not support it.


So how do I set the password for the root user so that I might be able to login with mysql -h127.0.0.1 -uroot -p (which I assume is more analogous to what MySQL Workbench would be doing)?










share|improve this question



























    0















    I just installed mysql-server on Ubuntu 18.0.4.2 LTS and I can now connect to the server just fine when I do mysql but I can't connect when I do mysql -h127.0.0.1 -uroot -p.



    When I logged in just now with mysql I did this:



    SET PASSWORD = 'mypassword';


    But that got me back this warning:



     SET PASSWORD has no significance for user 'root'@'localhost' as authentication plugin does not support it.


    So how do I set the password for the root user so that I might be able to login with mysql -h127.0.0.1 -uroot -p (which I assume is more analogous to what MySQL Workbench would be doing)?










    share|improve this question

























      0












      0








      0








      I just installed mysql-server on Ubuntu 18.0.4.2 LTS and I can now connect to the server just fine when I do mysql but I can't connect when I do mysql -h127.0.0.1 -uroot -p.



      When I logged in just now with mysql I did this:



      SET PASSWORD = 'mypassword';


      But that got me back this warning:



       SET PASSWORD has no significance for user 'root'@'localhost' as authentication plugin does not support it.


      So how do I set the password for the root user so that I might be able to login with mysql -h127.0.0.1 -uroot -p (which I assume is more analogous to what MySQL Workbench would be doing)?










      share|improve this question














      I just installed mysql-server on Ubuntu 18.0.4.2 LTS and I can now connect to the server just fine when I do mysql but I can't connect when I do mysql -h127.0.0.1 -uroot -p.



      When I logged in just now with mysql I did this:



      SET PASSWORD = 'mypassword';


      But that got me back this warning:



       SET PASSWORD has no significance for user 'root'@'localhost' as authentication plugin does not support it.


      So how do I set the password for the root user so that I might be able to login with mysql -h127.0.0.1 -uroot -p (which I assume is more analogous to what MySQL Workbench would be doing)?







      linux ubuntu mysql






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 18 at 1:46









      neubertneubert

      1,833174688




      1,833174688






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The issue is that MySQL now trusts the username the client is being run as IF you are connecting via a socket. You need to change to native password auth, and then set a password.



          ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypass';





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "3"
            };
            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%2fsuperuser.com%2fquestions%2f1406864%2fsetting-a-mysql-root-password%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            The issue is that MySQL now trusts the username the client is being run as IF you are connecting via a socket. You need to change to native password auth, and then set a password.



            ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypass';





            share|improve this answer




























              1














              The issue is that MySQL now trusts the username the client is being run as IF you are connecting via a socket. You need to change to native password auth, and then set a password.



              ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypass';





              share|improve this answer


























                1












                1








                1







                The issue is that MySQL now trusts the username the client is being run as IF you are connecting via a socket. You need to change to native password auth, and then set a password.



                ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypass';





                share|improve this answer













                The issue is that MySQL now trusts the username the client is being run as IF you are connecting via a socket. You need to change to native password auth, and then set a password.



                ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypass';






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 18 at 2:19









                ivanivanivanivan

                1,27427




                1,27427






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Super User!


                    • 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%2fsuperuser.com%2fquestions%2f1406864%2fsetting-a-mysql-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







                    Popular posts from this blog

                    Probability when a professor distributes a quiz and homework assignment to a class of n students.

                    Aardman Animations

                    Are they similar matrix