【问题标题】:How can I change the password of MySQL if I forget about it?如果我忘记了 MySQL 的密码,我该如何更改?
【发布时间】:2017-06-28 10:18:56
【问题描述】:

如果我忘记了 MySQL 的密码,如何重置?

关注mysql reset password。

当我运行这个命令时:

$ sudo mysql -u root  // refer to the given link '2. Start the mysqld demon process using the --skip-grant-tables option with this command '

我的终端出现此错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

【问题讨论】:

    标签: mysql terminal


    【解决方案1】:

    最后,我用其他方法解决了:

    1. 第 1 步, -> 系统偏好设置 -> 停止 mysql 服务器。
    2. 第 2 步,在终端中:

      $ cd /usr/local/mysql/bin/
      

      然后输入禁止mysql的验证功能:

      ./mysqld_safe --skip-grant-tables &
      

      然后mysql会重新启动,你可以在System Preferences -> MySQL查看它的运行状态。

    3. 第三步:
      然后输入:

      ./mysql
      FLUSH PRIVILEGES; 
      

      然后你可以重置你的mysql的密码:

      SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your new password');
      

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-21
      • 1970-01-01
      • 2017-05-01
      • 2016-09-28
      • 2022-07-23
      • 1970-01-01
      • 2010-11-21
      • 2012-12-19
      相关资源
      最近更新 更多