check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'xsw123456' WITH GRANT OPTION' at line 1

错误如图:
check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'xsw123456' WITH GRANT OPTION' at line 1
场景,mysql8.0.17修改mysql用户权限,开启所有ip可访问
使用:GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘密码‘ WITH GRANT OPTION;
报错,所以我使用如下方法
使用mysql
use mysql
修改密码:
ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘密码‘;
修改ip为所有可访问
update user set host=‘%‘ where user=‘root‘;
查看
select host,user from user;
刷新
flush privileges;

或者可以使用
ALTER USER ‘root‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘密码‘;
flush privileges;
navicat连接,ok

check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'xsw123456' WITH GRANT OPTION' at line 1

上一篇:SQL里合并两个 select 查询 结果


下一篇:part13:Python操作数据库(DP API 协议,操作SQLite,SQLite Expert,executemany,select,事务,executescript,创建自定义函数,创建聚集函数,创建比较函数,操作MySQL,pip工具使用,调用过程)