1.修改配置文件
#vim /etc/my.cnf(注:windows下修改的是my.ini)
在[mysqld]后面任意一行添加
explicit_defaults_for_timestamp=true
skip-grant-tables
保存并退出
2.重启mysql
service mysqld restart
3.登陆mysql
直接登陆
mysql -uroot
4.修改密码
use mysql
update user set authentication_string=password(“123456”) where user=“root”;