2018-11-01
閱讀量:
999
MySQL8.0創(chuàng)建用戶和授權(quán)
在mysql8.0創(chuàng)建用戶和授權(quán)和之前不太一樣了,其實嚴(yán)格上來講,也不能說是不一樣,只能說是更嚴(yán)格,mysql8.0需要先創(chuàng)建用戶和設(shè)置密碼,然后才能授權(quán)。
#先創(chuàng)建一個用戶
create
user
'hong'@'%'
identified by
'123123';
#再進行授權(quán)
grant
all
privileges
on
*.* to
'hong'@'%'
with
grant
option;
如果還是用原來5.7的那種方式,會報錯誤:
grant?all?privileges?on?*.*?to?'sroot'@'%'?identified?by?'123123';
ERROR?1064?(42000):?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?'identified?by?'123123''?at?line?1






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
1條評論