check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY '123456' 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
上面是修改root账号,以下是新增一个账号
create user 'test'@'localhost' identified by '密码';
flush privileges;刷新权限
其中localhost指本地才可连接

可以将其换成%指任意ip都能连接

也可以指定ip连接(192.168.110.131)
也可以指定网段(192.168.110.%)
grant all privileges on *.* to 'test'@'localhost' with grant option;
flush privileges;
ok


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



猜您在找 MySQL 8.0:check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'password'' at line 1 mysq添加外键报错:check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 1 check the manual that corresponds to your MySQL server version for the right syntax to use near '(0) NULL DEFAULT NULL COMMENT check the manual that corresponds to your MySQL server version for the right syntax to use near check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc 解决:[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 【异常】MySQL建表报错:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"order"' at line 1 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'groups)VALUES('1','hh','hh@163.com','Boss')' at line 1 Django进行数据迁移时,报错:(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(6) NOT NULL)' at line 1") You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"id",
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM