ERROR 1698 (28000): Access denied for user 'root'@'localhost' at Ubuntu 18.04











up vote
9
down vote

favorite
5












I have followed this tutorial to install MySQL but after successfully installed MySQL, I could not access database.




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











share|improve this question


















  • 1




    I faced the same issue, after some digging, got it that u have to set root password your self following instructions at the StackOverFlow.
    – Mohammad.H Fathi
    May 7 at 10:51















up vote
9
down vote

favorite
5












I have followed this tutorial to install MySQL but after successfully installed MySQL, I could not access database.




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











share|improve this question


















  • 1




    I faced the same issue, after some digging, got it that u have to set root password your self following instructions at the StackOverFlow.
    – Mohammad.H Fathi
    May 7 at 10:51













up vote
9
down vote

favorite
5









up vote
9
down vote

favorite
5






5





I have followed this tutorial to install MySQL but after successfully installed MySQL, I could not access database.




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











share|improve this question













I have followed this tutorial to install MySQL but after successfully installed MySQL, I could not access database.




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








permissions mysql lamp






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 28 at 11:15









Ashrafuzzaman Sujan

1392311




1392311








  • 1




    I faced the same issue, after some digging, got it that u have to set root password your self following instructions at the StackOverFlow.
    – Mohammad.H Fathi
    May 7 at 10:51














  • 1




    I faced the same issue, after some digging, got it that u have to set root password your self following instructions at the StackOverFlow.
    – Mohammad.H Fathi
    May 7 at 10:51








1




1




I faced the same issue, after some digging, got it that u have to set root password your self following instructions at the StackOverFlow.
– Mohammad.H Fathi
May 7 at 10:51




I faced the same issue, after some digging, got it that u have to set root password your self following instructions at the StackOverFlow.
– Mohammad.H Fathi
May 7 at 10:51










2 Answers
2






active

oldest

votes

















up vote
21
down vote



accepted










I found a solution at here link, by following this solution I have solved my problem.



Short steps are:



sudo mysql -u root
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';


Note: here test is a new password for the root user. Also, remember to run the command sudo service mysql restart after altering the user.






share|improve this answer























  • Thank you. It is odd mysql-server not propting to enter password anymore.
    – gamofe
    May 19 at 13:45










  • its worked !!!!!
    – Fatima Zohra
    May 31 at 7:30






  • 1




    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'b230mehonot'' at line 1
    – alhelal
    Jun 5 at 3:40










  • same error here... :(
    – user1111929
    Jun 8 at 20:57










  • @alhelal, The solution is for MySQL not for MariaDB. So you can try another solution.
    – Ashrafuzzaman Sujan
    Jun 21 at 1:43


















up vote
2
down vote













I found another way that is much better as we need not to give any password for local system.
It is as followed.



Open terminal and type



sudo mysql -u root -p


It will prompt you in mysql, here you can fire any mysql commands.



Use mysql table for change table type, so we can use empty password. Bellow is command for it



USE mysql;


Now we change type of table by following command



UPDATE user SET plugin='mysql_native_password' WHERE User='root';


now we have to flush the privileges, because we have used UPDATE. If you use INSERT, UPDATE or DELETE on grant tables directly you need use FLUSH PRIVILEGES in order to reload the grant tables.



FLUSH PRIVILEGES;


now exit from mysql by following command



exit;


now restart mysql server by following command



service mysql restart


Hope this may help



Thank you.






share|improve this answer





















    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%2f1029177%2ferror-1698-28000-access-denied-for-user-rootlocalhost-at-ubuntu-18-04%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








    up vote
    21
    down vote



    accepted










    I found a solution at here link, by following this solution I have solved my problem.



    Short steps are:



    sudo mysql -u root
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';


    Note: here test is a new password for the root user. Also, remember to run the command sudo service mysql restart after altering the user.






    share|improve this answer























    • Thank you. It is odd mysql-server not propting to enter password anymore.
      – gamofe
      May 19 at 13:45










    • its worked !!!!!
      – Fatima Zohra
      May 31 at 7:30






    • 1




      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'b230mehonot'' at line 1
      – alhelal
      Jun 5 at 3:40










    • same error here... :(
      – user1111929
      Jun 8 at 20:57










    • @alhelal, The solution is for MySQL not for MariaDB. So you can try another solution.
      – Ashrafuzzaman Sujan
      Jun 21 at 1:43















    up vote
    21
    down vote



    accepted










    I found a solution at here link, by following this solution I have solved my problem.



    Short steps are:



    sudo mysql -u root
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';


    Note: here test is a new password for the root user. Also, remember to run the command sudo service mysql restart after altering the user.






    share|improve this answer























    • Thank you. It is odd mysql-server not propting to enter password anymore.
      – gamofe
      May 19 at 13:45










    • its worked !!!!!
      – Fatima Zohra
      May 31 at 7:30






    • 1




      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'b230mehonot'' at line 1
      – alhelal
      Jun 5 at 3:40










    • same error here... :(
      – user1111929
      Jun 8 at 20:57










    • @alhelal, The solution is for MySQL not for MariaDB. So you can try another solution.
      – Ashrafuzzaman Sujan
      Jun 21 at 1:43













    up vote
    21
    down vote



    accepted







    up vote
    21
    down vote



    accepted






    I found a solution at here link, by following this solution I have solved my problem.



    Short steps are:



    sudo mysql -u root
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';


    Note: here test is a new password for the root user. Also, remember to run the command sudo service mysql restart after altering the user.






    share|improve this answer














    I found a solution at here link, by following this solution I have solved my problem.



    Short steps are:



    sudo mysql -u root
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';


    Note: here test is a new password for the root user. Also, remember to run the command sudo service mysql restart after altering the user.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Sep 20 at 9:01


























    community wiki





    3 revs, 3 users 78%
    Ashrafuzzaman Sujan













    • Thank you. It is odd mysql-server not propting to enter password anymore.
      – gamofe
      May 19 at 13:45










    • its worked !!!!!
      – Fatima Zohra
      May 31 at 7:30






    • 1




      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'b230mehonot'' at line 1
      – alhelal
      Jun 5 at 3:40










    • same error here... :(
      – user1111929
      Jun 8 at 20:57










    • @alhelal, The solution is for MySQL not for MariaDB. So you can try another solution.
      – Ashrafuzzaman Sujan
      Jun 21 at 1:43


















    • Thank you. It is odd mysql-server not propting to enter password anymore.
      – gamofe
      May 19 at 13:45










    • its worked !!!!!
      – Fatima Zohra
      May 31 at 7:30






    • 1




      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'b230mehonot'' at line 1
      – alhelal
      Jun 5 at 3:40










    • same error here... :(
      – user1111929
      Jun 8 at 20:57










    • @alhelal, The solution is for MySQL not for MariaDB. So you can try another solution.
      – Ashrafuzzaman Sujan
      Jun 21 at 1:43
















    Thank you. It is odd mysql-server not propting to enter password anymore.
    – gamofe
    May 19 at 13:45




    Thank you. It is odd mysql-server not propting to enter password anymore.
    – gamofe
    May 19 at 13:45












    its worked !!!!!
    – Fatima Zohra
    May 31 at 7:30




    its worked !!!!!
    – Fatima Zohra
    May 31 at 7:30




    1




    1




    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'b230mehonot'' at line 1
    – alhelal
    Jun 5 at 3:40




    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'b230mehonot'' at line 1
    – alhelal
    Jun 5 at 3:40












    same error here... :(
    – user1111929
    Jun 8 at 20:57




    same error here... :(
    – user1111929
    Jun 8 at 20:57












    @alhelal, The solution is for MySQL not for MariaDB. So you can try another solution.
    – Ashrafuzzaman Sujan
    Jun 21 at 1:43




    @alhelal, The solution is for MySQL not for MariaDB. So you can try another solution.
    – Ashrafuzzaman Sujan
    Jun 21 at 1:43












    up vote
    2
    down vote













    I found another way that is much better as we need not to give any password for local system.
    It is as followed.



    Open terminal and type



    sudo mysql -u root -p


    It will prompt you in mysql, here you can fire any mysql commands.



    Use mysql table for change table type, so we can use empty password. Bellow is command for it



    USE mysql;


    Now we change type of table by following command



    UPDATE user SET plugin='mysql_native_password' WHERE User='root';


    now we have to flush the privileges, because we have used UPDATE. If you use INSERT, UPDATE or DELETE on grant tables directly you need use FLUSH PRIVILEGES in order to reload the grant tables.



    FLUSH PRIVILEGES;


    now exit from mysql by following command



    exit;


    now restart mysql server by following command



    service mysql restart


    Hope this may help



    Thank you.






    share|improve this answer

























      up vote
      2
      down vote













      I found another way that is much better as we need not to give any password for local system.
      It is as followed.



      Open terminal and type



      sudo mysql -u root -p


      It will prompt you in mysql, here you can fire any mysql commands.



      Use mysql table for change table type, so we can use empty password. Bellow is command for it



      USE mysql;


      Now we change type of table by following command



      UPDATE user SET plugin='mysql_native_password' WHERE User='root';


      now we have to flush the privileges, because we have used UPDATE. If you use INSERT, UPDATE or DELETE on grant tables directly you need use FLUSH PRIVILEGES in order to reload the grant tables.



      FLUSH PRIVILEGES;


      now exit from mysql by following command



      exit;


      now restart mysql server by following command



      service mysql restart


      Hope this may help



      Thank you.






      share|improve this answer























        up vote
        2
        down vote










        up vote
        2
        down vote









        I found another way that is much better as we need not to give any password for local system.
        It is as followed.



        Open terminal and type



        sudo mysql -u root -p


        It will prompt you in mysql, here you can fire any mysql commands.



        Use mysql table for change table type, so we can use empty password. Bellow is command for it



        USE mysql;


        Now we change type of table by following command



        UPDATE user SET plugin='mysql_native_password' WHERE User='root';


        now we have to flush the privileges, because we have used UPDATE. If you use INSERT, UPDATE or DELETE on grant tables directly you need use FLUSH PRIVILEGES in order to reload the grant tables.



        FLUSH PRIVILEGES;


        now exit from mysql by following command



        exit;


        now restart mysql server by following command



        service mysql restart


        Hope this may help



        Thank you.






        share|improve this answer












        I found another way that is much better as we need not to give any password for local system.
        It is as followed.



        Open terminal and type



        sudo mysql -u root -p


        It will prompt you in mysql, here you can fire any mysql commands.



        Use mysql table for change table type, so we can use empty password. Bellow is command for it



        USE mysql;


        Now we change type of table by following command



        UPDATE user SET plugin='mysql_native_password' WHERE User='root';


        now we have to flush the privileges, because we have used UPDATE. If you use INSERT, UPDATE or DELETE on grant tables directly you need use FLUSH PRIVILEGES in order to reload the grant tables.



        FLUSH PRIVILEGES;


        now exit from mysql by following command



        exit;


        now restart mysql server by following command



        service mysql restart


        Hope this may help



        Thank you.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 1 at 14:17









        Krunal Pathak

        328




        328






























            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%2f1029177%2ferror-1698-28000-access-denied-for-user-rootlocalhost-at-ubuntu-18-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á

             ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕