how to reset my mysql password in mac os 10.13.3

后端 未结 2 1572
再見小時候
再見小時候 2020-12-20 05:48

I have a problem with MySQL. I forgot the password I used when I installed it so, I can not access to the server now. I tried deleting the MySQL and install it again but it

2条回答
  •  感动是毒
    2020-12-20 06:34

    You can try reseting the root password by running MySQL in Safe Mode.

    Here are the steps:

    1. Stop MySQL:

      sudo /usr/local/mysql/support-files/mysql.server stop

    2. Start it in safe mode:

      sudo mysqld_safe --skip-grant-tables

    This will be an ongoing command until the process is finished so open another shell/terminal window, and..

    1. Log in without a password as root:

      mysql -u root

    2. Update root (and any other user's) password)

      FLUSH PRIVILEGES; ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass'; \q

    3. Restart MySQL in normal mode

      sudo /usr/local/mysql/support-files/mysql.server start

    Reference: https://coolestguidesontheplanet.com/how-to-change-the-mysql-root-password/

    Note: this is pretty standard reset procedure, but just documented better in the above guide compared to mysql reference docs.

提交回复
热议问题