mysql 命令集

1、查看mysql所有用戶及權限
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;


2、查看數據庫中具體某個用戶的權限
show grants for 'root'@'%';


3、刷新權限
flush privileges;


4、創建用戶
create user 'datauser'@'10.10.11.%' identified by 'db-password';


5、顯示當前用戶
select user();


6、權限
grant all privileges on *.* to 'user'@'%' identified by 'password' with grant option;
grant all privileges on database.table to 'user'@'%' identified by 'password' with grant option;


7、修改密碼:
mysqladmin -u root -p 123 password 456 (使用mysqladmin語法:mysqladmin -u用戶名 -p舊密碼 password 新密碼)
set password for root@localhost=password('');


8、刪除用戶和撤銷權限
drop user username@'%'
delete from user where user='sss' and host='localhost';
發佈了33 篇原創文章 · 獲贊 9 · 訪問量 38萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章