Centos7重置Mysql 8.0.1 root 密码
问题产生背景: 安装完 最新版的 mysql8.0.1后忘记了密码,向重置root密码;找了网上好多资料都不尽相同,根据自己的问题总结如下: 第一步:修改配置文件免密码登录mysql [html] view plain copy vim /etc/my.cnf 1.2 在 [mysqld]最后加上如下语句 并保持退出文件; [html] view plain copy skip-grant-tables 1.3 重启mysql服务: [html] view plain copy service mysqld restart 第二步免密码登录到mysql上;直接在命令行上输入: [html] view plain copy mysql //或者 mysql -u root -p //password直接回车 第三步: 给root用户重置密码; 3.1 首先查看当前root用户相关信息,在mysql数据库的user表中; [html] view plain copy select host, user, authentication_string, plugin from user; host: 允许用户登录的ip‘位置’%表示可以远程; user:当前数据库的用户名; authentication_string: 用户密码;在mysql 5.7