mysql授予权限小结

注意授予ALL 权限是except GRANT OPTION!!!
mysql>
Enter the following if the database user already exists.:


GRANT SELECT ON database.* TO user@'localhost';
If you intend to create a brand new user, then run this:


GRANT SELECT ON database.* TO user@'localhost' IDENTIFIED BY 'password';
To enable more options, you would separate them with a comma. So to enable SELECT, INSERT, and DELETE your syntax would look like this:


GRANT SELECT, INSERT, DELETE ON database TO username@'localhost' IDENTIFIED BY 'password';
Once you have given the desired privileges for your user, you will need to run this command within the MySQL command prompt:


FLUSH PRIVILEGES;
To see a list of the privileges that have been granted to a specific user:

查看可以grant的权限有哪些:

select * from mysql.user where User='username';
This is a list of privileges that you can grant:

Result:

Privilege   Meaning
ALL [PRIVILEGES]    Sets all simple privileges except GRANT OPTION
ALTER   Enables use of ALTER TABLE
CREATE  Enables use of CREATE TABLE
CREATE TEMPORARY TABLES Enables use of CREATE TEMPORARY TABLE
DELETE  Enables use of DELETE
DROP    Enables use of DROP TABLE
EXECUTE Not implemented
FILE    Enables use of SELECT ... INTO OUTFILE and LOAD DATA INFILE
INDEX   Enables use of CREATE INDEX and DROP INDEX
INSERT  Enables use of INSERT
LOCK TABLES Enables use of LOCK TABLES on tables for which you have the SELECT privilege
PROCESS Enables the user to see all processes with SHOW PROCESSLIST
REFERENCES  Not implemented
RELOAD  Enables use of FLUSH
REPLICATION CLIENT  Enables the user to ask where slave or master servers are
REPLICATION SLAVE   Needed for replication slaves (to read binary log events from the master)
SELECT  Enables use of SELECT
SHOW DATABASES  SHOW DATABASES shows all databases
SHUTDOWN    Enables use of MySQLadmin shutdown
SUPER   Enables use of CHANGE MASTER, KILL, PURGE MASTER LOGS, and SET GLOBAL statements, the MySQLadmin debug command; allows you to connect (once) even if max_connections is reached
UPDATE  Enables use of UPDATE
USAGE   Synonym for privileges
GRANT OPTION    Enables privileges to be granted

Reference link:
https://mediatemple.net/community/products/dv/204404494/how-do-i-grant-privileges-in-mysql

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值