創建用戶的語法: Create user `username`@host [Identified by [password] `password`]; 例: create user `teacher`@`localhost` identified by ‘12345’, 或者 create user ...
- 創建用戶的語法:
Create user `username`@host [Identified by [password] `password`];
- Username:用戶名
- Host:主機名,本地主機可以用localhost或者ip地址,但是其他電腦必須用ip地址登錄遠程主機用通配符 “%”
- Password:用戶密碼
例:
create user `teacher`@`localhost` identified by ‘12345’, 或者
create user `teacher`@`localhost (無密碼)
- 執行grant(賦許可權的同時) 創建用戶
語法:
Grant priv_type on 資料庫或者數據表 to username@localhost(或者IP地址) identified by ‘123’;
- 使用mysql Admin修改root賬戶密碼
- 語法:
Mysqladmin –u root –p password “123”;
Enter password:原密碼(root);
- 使用set密令修改普通用戶密碼(mysql的命令)
語法:
Set password=password(“000”); //修改當前用戶密碼
Set password for teacher@localhost=password(“123”); //修改指定賬戶密碼
- 刪除普通用戶
Drop user `studentr` @localhost;