一、建立子賬號
create user 'test
'@'localhost
' identified by '
123456
'; #這種建立方式只能本地登入
create user
'test
'@'%
' identified by '
123456
'; #這種建立方式可以遠端登入,即別的地方可以登入
二、新增許可權
語法:%代表所有連線
grant all privileges on 資料庫名.表名 to '新使用者名稱
'@'指定ip
' identified by '
新使用者密碼
' ;
舉例:8.0使用這種方式管用,*.*代表所有庫和所有表
grant all privileges on *.* to 'liuzhihao
'@'%
' with grant option
三、刪除子賬號
drop user test@"localhost
";
Mysql建立子賬號以及許可權設定
命令 建立乙個使用者名為test,密碼為123456的子賬號。命令 create user test localhost identified by 123456 這種建立方式只能本地登入 create user test identified by 123456 這種建立方式可以遠端登入,即別的地...
MySQL建立賬號
以root使用者登入資料庫,執行以下命令 create user zhangsan identified by zhangsan 上面的命令建立了使用者zhangsan,密碼是zhangsan。在mysql.user表裡可以檢視到新增使用者的資訊 命令格式 grant privilegescode ...
mysql建立賬號
建立乙個名叫user1,密碼pigcms的賬號,並賦予給它查詢,插入,更新,刪除 pigcms.pigcms庫所有表 的許可權 grant select insert update delete on pigcms to user1 identified by pigcms flush privil...