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