mysql 用戶建立、受權及刪除、取消權限操做

刪除、取消權限操做mysql

1. drop user 'user_name'@'%';sql

2. drop user 'user_name'@'localhost'ide

3. flush privileges; //從新加載受權表spa

注意:delete from user where user='user_name';直接操做mysql.user表不行,重建同名用戶時會出現「operation CREATE USER failed」錯誤提示信息io

 

添加用戶、受權操做class

1. create USER ’user_name' identified by 'password'; //建立用戶名和密碼權限

2. grant ALL ON 'db_name'.'tb_name' TO 'user_name'@'%' identified by 'password' //給 ‘user_name’@'%'受權密碼

3. grant ALL ON 'db_name'.'tb_name' TO 'user_name'@'localhost' identified by 'password' //給 'user_name'@'localhost'受權db

4. flush privileges; //從新加載受權表word

相關文章
相關標籤/搜索