如果上面的方式不能修改可以使用下面安全模式修改root:关闭服务systemctl stop mysqld.servicevi /etc/my.cnfmysqld下面添加skip-grant-tables 保存退出启动服务systemctl start mysqld.servicemysql -u root 不用密码直接回车use mysqlUpdate user set authentiCation_string=password(‘root-123') where user='root'and host='localhost';flush privileges;exit;vi /etc/my.cnf 把 skip-grant-tables 一句删除保存退出重启mysql服务systemctl restart mysqld.service再次登录即可mysql -u root -proot-123














发表评论