Forgot your password mysql under Windows, reconfigured

Forgot your password mysql under Windows, reconfigured

Question: Navicat to seek death inside connection is removed, and then re-establish the connection, resulting in this:
enter description here

Online check the information, found the back of their own forgotten passwords, so follow the tutorial to go again

  1. Sql service first stopped, so that subsequent operations
    net stop mysql
    show:
    Invalid service name.
    Type NET HELPMSG 2185 to get more help.
    enter description here

When the search is found, it is that they have to turn over the names mysql
specific operations:

  • Enter services.msc
  • Find mysql, found the name changed to the MySQL57
  • Enter net stop MySQL57
  • enter description here
  • enter description here
  1. Skip verification, go directly to the mysql modify the password
    to open the mysql installation directory: C: \ Program Files \ MySQL \ MySQL Server 5.7 \ bin>
    input directly into the corresponding cmd cmd window title bar
    input mysqld --skip-grant- tables

The results : prompt failure (normal is that this window can not be entered), and if so can refer to this blog second part: 2 need to reset the root password (forget the root password)
https://blog.csdn.net/ qq_36735409 / article / details / 78032144

另外解决办法
参考:https://www.cnblogs.com/zhiliang9408/p/9851939.html
主要的问题是找到这里面说的my.ini文件,开始怎么都没找到,后面用Evernote找到了,在C:\ProgramData\MySQL\MySQL Server 5.7
在文档内搜索mysqld定位到[mysqld]文本段,在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程

  • 重启mysql:net start MySQL57

  • 输入:mysql -u root -p
    注意,这里的提示输入密码,直接回车即可
    输入:show databases;
    看下是否的确进入了mysql

  • 输入update user set password=password("jiayou7311") where user='root';修改密码,结果:
    ERROR 1054 (42S22): Unknown column 'password' in 'field list
    enter description here

原因:原因是 5.7版本下的mysql数据库下已经没有password这个字段了,password字段改成了authentication_string
输入:
update mysql.user set authentication_string=password('jiayou7311');
修改成功
enter description here

  • 刷新:flush privileges;
    enter description here

  • Exit: quit
    enter description here

  • Delete my.ini in the field to add swap

  1. Log back
    mysql -u root -p
    success:
    enter description here

Guess you like

Origin www.cnblogs.com/muche-moqi/p/12096694.html