mysql -u root -p
#輸入密碼
創建一個用戶名爲zzy,密碼爲zzy的mysql普通用戶,並且授權該用戶只有對zzy這個數據庫有操作權限.
1.1第一種方式:
use mysql;
insert into user (user,host,password) values ('zzy','localhost',password('zzy'));
#授權
grant all privileges on zzy.* to zzy;
#刷新權限表
flush privileges;
1.2第二種方式:
create user zzy@'localhost' identified by 'zzy'
#授權
grant all privileges on zzy.* to zzy;
#flush privileges;