vim /etc/my.cnf

在[mysqld]后面任意一行添加“skip-grant-tables”用来跳过密码验证的过程,如下图所示:

 

 :wq  回车  保存

  重启mysql  systemctl restart mysqld.service

  mysql -uroot -p  回车

 修改远程访问:GRANT ALL ON *.* TO root@'%' IDENTIFIED BY ‘password’ WITH GRANT OPTION;  

  修改密码 :ALTER USER 'root'@%IDENTIFIED WITH mysql_native_password BY '密码';

  改完密码记得把 my.ini文件中的 skip-grant-tables 去掉  然后重启mysql

posted on 2020-11-12 14:13  博客园197  阅读(183)  评论(0)    收藏  举报