mysql版本:8.0
1洞难、 登錄mysql,并且選中mysql數(shù)據(jù)庫(kù)
mysql -u root;
use mysql;
2揭朝、 創(chuàng)建用戶(hù)队贱,以xiaoming
為例色冀,password
就是xaioming
的密碼
create user 'xiaoming'@'%' identified by 'password';
3、 給用戶(hù)賦予訪問(wèn)權(quán)限,*.*
是所有庫(kù)中所有表的權(quán)限
grant all privileges on *.* to xaioming@'%';
最后刷新一下
FLUSH PRIVILEGES;