MySQL server version for the right syntax to use near 'identified


本文借鑒https://blog.csdn.net/shenhonglei1234/article/details/84786443
因為mysql升級到>8.0.13后, 授權指令要分開執行:

#創建賬戶(此例為root)
create user 'root'@'%' identified by  'password';

#賦予權限,with grant option這個選項表示該用戶可以將自己擁有的權限授權給別人
grant all privileges on *.* to 'root'@'%' with grant option;

#改密碼&授權超用戶,flush privileges 命令本質上的作用是將當前user和privilige表中的用戶信息/權限設置從mysql庫(MySQL數據庫的內置庫)中提取到內存里
flush privileges;

還想在這一步驟中獲取更多信息的話可以這樣做:

查看某個用戶的權限:
show grants for username@host; #用戶名@主機

查看所有用戶:
select host,user from mysql.user;

Mysql用戶創建:
使用create user命令創建:
create user '用戶名'@'主機' identified by '密碼';

...
更多請見https://blog.51cto.com/11555417/2160730


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM