美文网首页
Forgot the MySQL root user passw

Forgot the MySQL root user passw

作者: 景彧 | 来源:发表于2017-01-11 18:18 被阅读39次

    Have you forgotten your Mac OS X 'ROOT' password and need to reset it? Follow these 4 simple steps:
    你是否忘记MySQL的根用户的登录密码?根据以下4点可以实现重设密码:

    1. Stop the mysqld server. Typically this can be done by from 'System Prefrences' > MySQL > 'Stop MySQL Server'
      (先在设置中关闭MySQL运行的服务)

    2. Start the server in safe mode with privilege bypass From a terminal:
      (在终端中使用以下命令使用安全模式开启MySQL服务)

    sudo /usr/local/mysql/bin/mysqld_safe --skip-grant-tables
    
    1. In a new terminal window:
      (刚才的终端不要理它,重新开启一个新的终端窗口,然后输入以下的命令)
     a). sudo /usr/local/mysql/bin/mysql -u root
    

    (下面的这个命令中,把NewPassword替换成你自己的密码)

      b). UPDATE mysql.user SET Password=PASSWORD('NewPassword') WHERE user='root'
    
    c). FLUSH PRIVILEGES
    
    d). \q
    

    <注意:上面的a、b、c、d是编号,不属于命令的内容。>

    1. Stop the mysqld server again and restart it in normal mode.
      (在设置中再次关闭MySQL运行的服务,然后又开启服务)

    相关文章

      网友评论

          本文标题:Forgot the MySQL root user passw

          本文链接:https://www.haomeiwen.com/subject/rwurbttx.html