my.ini 加入 skip-grant-tables
进入
mysql -u root -p
update MySQL.user set authentication_string=password('123456') where user='root' ;
my.ini 关闭 #skip-grant-tables
重启
net stop mysql
net start mysql
mysql -u root -p123456
set password = password('12345');
grant all privileges on *.* to 'root' @'%' identified by '12345';
附件(my.ini 文件内容)
[client]
port=3306
default-character-set=utf8
[mysqld]
#设置mysql的安装目录
basedir=D:\mysql-5.7.18-winx64
#设置mysql的数据目录
datadir=D:\mysql-5.7.18-winx64\data
character_set_server=utf8
sql_mode=NO_ENGINE_SUBSTITUTION,NO_AUTO_CREATE_USER
#开启查询缓存
explicit_defaults_for_timestamp=true
#skip-grant-tables