MySQL root password change

前端 未结 22 2825
被撕碎了的回忆
被撕碎了的回忆 2020-11-29 18:30

I have been trying to reset my MySQL root password. I have run the mysqld_safe --skip-grant-tables, updated the root password, and checked the user table to make sure it is

22条回答
  •  执笔经年
    2020-11-29 18:52

    You have to reset the password! steps for mac osx(tested and working) and ubuntu

    Stop MySQL

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

    Start it in safe mode:

    $ sudo mysqld_safe --skip-grant-tables
    

    (above line is the whole command)

    This will be an ongoing command until the process is finished so open another shell/terminal window, log in without a password:

    $ mysql -u root
    
    mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
    

    Start MySQL

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

    your new password is 'password'.

提交回复
热议问题