Reset MySQL root password using ALTER USER statement after install on Mac

后端 未结 19 2054
慢半拍i
慢半拍i 2020-11-29 14:21

I\'m new to the whole Mac experience. I recently installed MySQL and it seems I have to reset the password after install. It won\'t let me do anything else.

Now I al

相关标签:
19条回答
  • 2020-11-29 15:08

    On Ver 14.14 Distrib 5.7.19, for macos10.12 (x86_64), I logged in as: mysql -uroot -p then typed in the generated password by MySQL when you install it. Then..

    ALTER USER 'root'@'localhost' IDENTIFIED BY '<new_password>';

    Example:

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Ab1234'; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye $ mysql -uroot -p

    And you can type in 'Ab1234'

    0 讨论(0)
  • 2020-11-29 15:10

    When you use SET PASSWORD = PASSWORD('your_new_password'); it may crash for it

    (ERROR 1819 (HY000): Your password does not satisfy the current policy requirements)

    .you can use SET GLOBAL validate_password_policy=LOW; to slove it.

    0 讨论(0)
  • 2020-11-29 15:12

    This worked for me:

    ALTER USER USER() IDENTIFIED BY 'auth_string';

    I found it here: http://dev.mysql.com/doc/refman/5.7/en/alter-user.html#alter-user-current

    0 讨论(0)
  • 2020-11-29 15:12

    Had the problem after I installed mysql workbench and mysql community server. Got generated password during the server installation. Double clicking on the exisiting local instance in workbench triggered a dialog where I could set the new password.

    0 讨论(0)
  • 2020-11-29 15:13

    On MySQL 5.7.x you need to switch to native password to be able to change it, like:

    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'test';
    
    0 讨论(0)
  • 2020-11-29 15:13

    I also got the same problem in mac OS X 10.10.4(Yosemite).SET PASSWORD work for me.Alter password for mysql- mysql> SET PASSWORD = PASSWORD('your_password'); Query OK, 0 rows affected, 1 warning (0.01 sec)

    set your Mysql environment path variable in .bash_profile and add the below line
    export PATH=$PATH:/usr/local/mysql/bin, after that, run the following command :source .bash_profile

    0 讨论(0)
提交回复
热议问题