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

后端 未结 19 2183
慢半拍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:18

    Run these:

    $ cd /usr/local/mysql/bin
    $ ./mysqladmin -u root password 'password'
    

    Then run

    ./mysql -u root
    

    It should log in. Now run FLUSH privileges;

    Then exit the MySQL console and try logging in. If that doesn't work run these:

    $ mysql -u root
    mysql> USE mysql;
    mysql> UPDATE user SET authentication_string=PASSWORD("XXXXXXX") WHERE User='root';
    mysql> FLUSH PRIVILEGES;
    mysql> quit
    

    Change xxxxxx to ur new password. Then try logging in again.

    Update. See this http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html

    It should solve your problem.

    If you are on oracle try this

    ALTER USER username IDENTIFIED BY password
    

提交回复
热议问题