Set a password to a pre-hashed value in mysqlMySQL Post-Installation on a Mac OSX Snow LeopardGrant MySQL...

Which communication protocol is used in AdLib sound card?

Can you tell from a blurry photo if focus was too close or too far?

Changing the laptop's CPU. Should I reinstall Linux?

Is there a lava-breathing lizard creature (that could be worshipped by a cult) in 5e?

Building an exterior wall within an exterior wall for insulation

Why zero tolerance on nudity in space?

Definition of "atomic object"

What is the wife of a henpecked husband called?

False written accusations not made public - is there law to cover this?

Removing whitespace between consecutive numbers

Does it take energy to move something in a circle?

What game did these black and yellow dice come from?

Can I announce prefix 161.117.25.0/24 even though I don't have all of /24 IPs

Nuance between philia and mania?

How much mayhem could I cause as a fish?

Citing paid articles from illegal web sharing

Is a new boolean field better than null reference when a value can be meaningfully absent?

Why does PHOTOREC keep finding files?

Saint abbreviation

In Linux what happens if 1000 files in a directory are moved to another location while another 300 files were added to the source directory?

Separate environment for personal and development use under macOS

Why was Lupin comfortable with saying Voldemort's name?

Has Britain negotiated with any other countries outside the EU in preparation for the exit?

Why did Democrats in the Senate oppose the Born-Alive Abortion Survivors Protection Act?



Set a password to a pre-hashed value in mysql


MySQL Post-Installation on a Mac OSX Snow LeopardGrant MySQL user ability to create databases, and only allow them to access those databasesWeird behaviour with mysql port forwardingmysql how to fix Access denied for user 'root'@'localhost'OpenSuSE 10.2: create MySQL database with “Access denied for user 'root'@'localhost'”Cannot use mysql after removing root user from mysqldHow to have MySQL entitle the machine's root user?Not able to use MySQL commands after installationmySQL how to fix user after I mistakenly added localhost to user instead of 127.0.0.1Encountering password error in re-installing MYSQL server













3















How can I set a mysql user's password using a pre-hashed password?



=====



I've got a mysql database version 5.1.73 .



According to the mysql documentation, in the newer versions of mysql, creating a user using a prehashed password



CREATE USER 'ans'@'localhost'
IDENTIFIED BY PASSWORD 'hash_string'



is deprecated and will be removed in a future MySQL release.




However, I cannot figure out what (if anything) is the new way to accomplish this.



We use cobbler to set up our databases, and I would like to pre-populate my databases with the accounts they will need, along with the passwords they will use, without having the clear-text passwords in my scripts. I would have thought



update mysql.user
set password = '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
where user = 'ans';


would do the trick, but from my testing, that doesn't actually change the mysql login password.



mysql> create user 'ans'@'localhost' identified by 'foo';
mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| ans | localhost | *F3A2A51A9B0F2BE2468926B4132313728C250DBF |
+------+-----------+-------------------------------------------+
mysql> update mysql.user set password = password('bar') where user = 'ans';
Query OK, 1 row affected (0.00 sec)
mysql> select user,host,password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| ans | localhost | *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB |
+------+-----------+-------------------------------------------+
mysql> quit
$ mysql -uans -pbar
ERROR 1045 (28000): Access denied for user 'ans'@'localhost' (using password: YES)
$ mysql -uans -pfoo
Welcome to the MySQL monitor. Commands end with ; or g.









share|improve this question














bumped to the homepage by Community 21 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    3















    How can I set a mysql user's password using a pre-hashed password?



    =====



    I've got a mysql database version 5.1.73 .



    According to the mysql documentation, in the newer versions of mysql, creating a user using a prehashed password



    CREATE USER 'ans'@'localhost'
    IDENTIFIED BY PASSWORD 'hash_string'



    is deprecated and will be removed in a future MySQL release.




    However, I cannot figure out what (if anything) is the new way to accomplish this.



    We use cobbler to set up our databases, and I would like to pre-populate my databases with the accounts they will need, along with the passwords they will use, without having the clear-text passwords in my scripts. I would have thought



    update mysql.user
    set password = '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
    where user = 'ans';


    would do the trick, but from my testing, that doesn't actually change the mysql login password.



    mysql> create user 'ans'@'localhost' identified by 'foo';
    mysql> select user,host,password from mysql.user;
    +------+-----------+-------------------------------------------+
    | user | host | password |
    +------+-----------+-------------------------------------------+
    | ans | localhost | *F3A2A51A9B0F2BE2468926B4132313728C250DBF |
    +------+-----------+-------------------------------------------+
    mysql> update mysql.user set password = password('bar') where user = 'ans';
    Query OK, 1 row affected (0.00 sec)
    mysql> select user,host,password from mysql.user;
    +------+-----------+-------------------------------------------+
    | user | host | password |
    +------+-----------+-------------------------------------------+
    | ans | localhost | *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB |
    +------+-----------+-------------------------------------------+
    mysql> quit
    $ mysql -uans -pbar
    ERROR 1045 (28000): Access denied for user 'ans'@'localhost' (using password: YES)
    $ mysql -uans -pfoo
    Welcome to the MySQL monitor. Commands end with ; or g.









    share|improve this question














    bumped to the homepage by Community 21 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      3












      3








      3








      How can I set a mysql user's password using a pre-hashed password?



      =====



      I've got a mysql database version 5.1.73 .



      According to the mysql documentation, in the newer versions of mysql, creating a user using a prehashed password



      CREATE USER 'ans'@'localhost'
      IDENTIFIED BY PASSWORD 'hash_string'



      is deprecated and will be removed in a future MySQL release.




      However, I cannot figure out what (if anything) is the new way to accomplish this.



      We use cobbler to set up our databases, and I would like to pre-populate my databases with the accounts they will need, along with the passwords they will use, without having the clear-text passwords in my scripts. I would have thought



      update mysql.user
      set password = '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
      where user = 'ans';


      would do the trick, but from my testing, that doesn't actually change the mysql login password.



      mysql> create user 'ans'@'localhost' identified by 'foo';
      mysql> select user,host,password from mysql.user;
      +------+-----------+-------------------------------------------+
      | user | host | password |
      +------+-----------+-------------------------------------------+
      | ans | localhost | *F3A2A51A9B0F2BE2468926B4132313728C250DBF |
      +------+-----------+-------------------------------------------+
      mysql> update mysql.user set password = password('bar') where user = 'ans';
      Query OK, 1 row affected (0.00 sec)
      mysql> select user,host,password from mysql.user;
      +------+-----------+-------------------------------------------+
      | user | host | password |
      +------+-----------+-------------------------------------------+
      | ans | localhost | *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB |
      +------+-----------+-------------------------------------------+
      mysql> quit
      $ mysql -uans -pbar
      ERROR 1045 (28000): Access denied for user 'ans'@'localhost' (using password: YES)
      $ mysql -uans -pfoo
      Welcome to the MySQL monitor. Commands end with ; or g.









      share|improve this question














      How can I set a mysql user's password using a pre-hashed password?



      =====



      I've got a mysql database version 5.1.73 .



      According to the mysql documentation, in the newer versions of mysql, creating a user using a prehashed password



      CREATE USER 'ans'@'localhost'
      IDENTIFIED BY PASSWORD 'hash_string'



      is deprecated and will be removed in a future MySQL release.




      However, I cannot figure out what (if anything) is the new way to accomplish this.



      We use cobbler to set up our databases, and I would like to pre-populate my databases with the accounts they will need, along with the passwords they will use, without having the clear-text passwords in my scripts. I would have thought



      update mysql.user
      set password = '*E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB'
      where user = 'ans';


      would do the trick, but from my testing, that doesn't actually change the mysql login password.



      mysql> create user 'ans'@'localhost' identified by 'foo';
      mysql> select user,host,password from mysql.user;
      +------+-----------+-------------------------------------------+
      | user | host | password |
      +------+-----------+-------------------------------------------+
      | ans | localhost | *F3A2A51A9B0F2BE2468926B4132313728C250DBF |
      +------+-----------+-------------------------------------------+
      mysql> update mysql.user set password = password('bar') where user = 'ans';
      Query OK, 1 row affected (0.00 sec)
      mysql> select user,host,password from mysql.user;
      +------+-----------+-------------------------------------------+
      | user | host | password |
      +------+-----------+-------------------------------------------+
      | ans | localhost | *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB |
      +------+-----------+-------------------------------------------+
      mysql> quit
      $ mysql -uans -pbar
      ERROR 1045 (28000): Access denied for user 'ans'@'localhost' (using password: YES)
      $ mysql -uans -pfoo
      Welcome to the MySQL monitor. Commands end with ; or g.






      passwords mysql hashing






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 15 '16 at 16:06









      hymiehymie

      896413




      896413





      bumped to the homepage by Community 21 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 21 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          When you hack the password into mysql.user, you are supposed to run



          mysql> FLUSH PRIVILEGES;


          According to the MySQL Documentation on FLUSH




          PRIVILEGES



          Reloads the privileges from the grant tables in the mysql database.



          The server caches information in memory as a result of GRANT, CREATE
          USER, CREATE SERVER, and INSTALL PLUGIN statements. This memory is not
          released by the corresponding REVOKE, DROP USER, DROP SERVER, and
          UNINSTALL PLUGIN statements, so for a server that executes many
          instances of the statements that cause caching, there will be an
          increase in memory use. This cached memory can be freed with FLUSH
          PRIVILEGES.




          Now, you have to restart MySQL for the password to take affect.






          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%2f1065890%2fset-a-password-to-a-pre-hashed-value-in-mysql%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









            0














            When you hack the password into mysql.user, you are supposed to run



            mysql> FLUSH PRIVILEGES;


            According to the MySQL Documentation on FLUSH




            PRIVILEGES



            Reloads the privileges from the grant tables in the mysql database.



            The server caches information in memory as a result of GRANT, CREATE
            USER, CREATE SERVER, and INSTALL PLUGIN statements. This memory is not
            released by the corresponding REVOKE, DROP USER, DROP SERVER, and
            UNINSTALL PLUGIN statements, so for a server that executes many
            instances of the statements that cause caching, there will be an
            increase in memory use. This cached memory can be freed with FLUSH
            PRIVILEGES.




            Now, you have to restart MySQL for the password to take affect.






            share|improve this answer




























              0














              When you hack the password into mysql.user, you are supposed to run



              mysql> FLUSH PRIVILEGES;


              According to the MySQL Documentation on FLUSH




              PRIVILEGES



              Reloads the privileges from the grant tables in the mysql database.



              The server caches information in memory as a result of GRANT, CREATE
              USER, CREATE SERVER, and INSTALL PLUGIN statements. This memory is not
              released by the corresponding REVOKE, DROP USER, DROP SERVER, and
              UNINSTALL PLUGIN statements, so for a server that executes many
              instances of the statements that cause caching, there will be an
              increase in memory use. This cached memory can be freed with FLUSH
              PRIVILEGES.




              Now, you have to restart MySQL for the password to take affect.






              share|improve this answer


























                0












                0








                0







                When you hack the password into mysql.user, you are supposed to run



                mysql> FLUSH PRIVILEGES;


                According to the MySQL Documentation on FLUSH




                PRIVILEGES



                Reloads the privileges from the grant tables in the mysql database.



                The server caches information in memory as a result of GRANT, CREATE
                USER, CREATE SERVER, and INSTALL PLUGIN statements. This memory is not
                released by the corresponding REVOKE, DROP USER, DROP SERVER, and
                UNINSTALL PLUGIN statements, so for a server that executes many
                instances of the statements that cause caching, there will be an
                increase in memory use. This cached memory can be freed with FLUSH
                PRIVILEGES.




                Now, you have to restart MySQL for the password to take affect.






                share|improve this answer













                When you hack the password into mysql.user, you are supposed to run



                mysql> FLUSH PRIVILEGES;


                According to the MySQL Documentation on FLUSH




                PRIVILEGES



                Reloads the privileges from the grant tables in the mysql database.



                The server caches information in memory as a result of GRANT, CREATE
                USER, CREATE SERVER, and INSTALL PLUGIN statements. This memory is not
                released by the corresponding REVOKE, DROP USER, DROP SERVER, and
                UNINSTALL PLUGIN statements, so for a server that executes many
                instances of the statements that cause caching, there will be an
                increase in memory use. This cached memory can be freed with FLUSH
                PRIVILEGES.




                Now, you have to restart MySQL for the password to take affect.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 22 '16 at 3:49









                RolandoMySQLDBARolandoMySQLDBA

                2,49511424




                2,49511424






























                    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%2f1065890%2fset-a-password-to-a-pre-hashed-value-in-mysql%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

                    VNC viewer RFB protocol error: bad desktop size 0x0I Cannot Type the Key 'd' (lowercase) in VNC Viewer...

                    Tribunal Administrativo e Fiscal de Mirandela Referências Menu de...

                    looking for continuous Screen Capture for retroactivly reproducing errors, timeback machineRolling desktop...