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

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

    If you use MySQL 5.7.6 and later:

    ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
    

    If you use MySQL 5.7.5 and earlier:

    SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
    

    MySQL Documentation

提交回复
热议问题