1、設置密碼 set password for 用戶名@localhost = password('密碼'); 2、取消密碼 set password for 用戶名@localhost = password(''); 3、創建賬號 create user admin identified by ' ...
1、設置密碼
set password for 用戶名@localhost = password('密碼');
2、取消密碼
set password for 用戶名@localhost = password('');
3、創建賬號
create user admin identified by '123';
create user 'admin'@'%' identified by '123';
4、刪除賬號
delete from mysql.user where user=用戶名;
drop user 用戶名;
5、授權並建立賬號
grant all privileges on *.* to 用戶名@localhost;--創建一個只能本地登錄的空密碼用戶
grant all privileges on *.* to '用戶名'@localhost identified by 密碼;--創建一個只能本地登錄的用戶
grant all privileges on *.* to '用戶名'@'%': --創建一個可以遠程登錄的用戶
6、收回許可權
revoke all privileges on *.* from '用戶名'@'%':