【问题标题】:Reset Mysql workbench root password重置Mysql工作台root密码
【发布时间】:2016-05-27 04:49:29
【问题描述】:

我搞砸了一些事情,我尝试在 mysql 工作台中创建一个本地服务器,但每次测试连接时都会显示一条错误消息。

我尝试卸载 mysql 工作台并再次安装,但用户“root”未知。在安装过程中它没有告诉任何关于 root 密码的信息,我尝试了各种密码,如空字符串、我的 mac 密码等,但它们都不起作用,我尝试在 stackoverflow 中进行研究,但我仍然无法解决。

【问题讨论】:

  • 你必须在 MySQL 的服务器端更改一些东西,因为 MySQL 工作台只是一个客户端,与密码设置无关。
  • 如何更改?在mac中,在首选项下,它只有停止mysql服务器按钮?

标签: mysql sql mysql-workbench


【解决方案1】:

MAC用户/OSX用户

登录 MySQL 终端时尝试命令FLUSH PRIVILEGES。 如果这不起作用,请在 MySQL 终端中尝试以下命令集

$ mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

使用您想要的任何密码更改NEWPASSWORD。应该都准备好了!

Update: 从 MySQL 5.7 开始,密码字段已重命名为 authentication_string。更改密码时,请使用以下查询更改密码。所有其他命令保持不变:

mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';

【讨论】:

  • 我收到一个错误 ERROR 1054 (42S22): Unknown column 'password' in 'field list'
  • 执行第三行时
  • 告诉我你的mysql版本
  • 服务器版本:5.7.11 MySQL Community Server (GPL)
  • 而不是第三行,执行这个.. UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") where User='root';
【解决方案2】:

Mysql更改忘记密码

0) shut down service mysql56

1) go to C:\ProgramData\MySQL\MySQL Server 5.6
 (note that ProgramData is a hidden folder)

2) look for file my.ini, open it and add one line skip-grant-tables below [mysqld],
      save  [mysqld]

skip-grant-tables
3) start service mysql56

4) by right, you can access the database, and use the query below to update the password

update mysql.user set password=PASSWORD('NEW PASSWORD') where user='root';
5) shun down the service again, remove the line skip-grant-tables save it, and start the service again. try to use the password you set to login.

【讨论】:

    猜你喜欢
    • 2012-02-08
    • 2018-06-09
    • 1970-01-01
    • 2014-01-13
    • 2019-04-23
    • 2011-05-14
    • 2016-10-13
    相关资源
    最近更新 更多