当前位置:网站首页>MySQL create user and authorize
MySQL create user and authorize
2022-06-12 03:23:00 【Wangyue Lake】
MySQL Create users and authorize
Create user
Use Command to create
# Use CREATE CREATE USER 'testDatabase'@'%' IDENTIFIED BY '111111'; # CREATE USER ' Your username '@' Database accessible ip,% Express all ' IDENTIFIED BY ' Database password # Use GRANT USAGE,USAGE Indicates that you do not have any permissions . GRANT USAGE ON *.* TO 'dummy'@'localhost';sql establish
INSERT INTO user (Host,User,Password) values('ip',' user name ',' password ')
User authorization
Use Command to create
GRANT ALL ON testDatabase_jixian.* TO 'username'@'%';sql establish
INSERT INTO user (Host, User, Password) (HOST,Db, USER, Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv) VALUES ('ip',' database ',' user name ', 'Y','Y','Y','Y','Y','Y');
explain
- GRANT
- ALL # all Indicates that you have all the permissions on the database , also SELECT,INSERT,UPDATE,delete,drop,create wait . Built or not all
- ON testDatabase_jixian.* Database name . Table name ,* Represents all databases or all tables ,
- TO
- ‘username’@‘%’; # User name and ip
Be careful :
- User reconnection is required after authorization MySQL, To obtain the corresponding permission .
- Users authorized by the above command cannot authorize other users , If you want to activate this authorization , Use the following command :
# add WITH GRANT OPTION
GRANT privilegesxxx ON databasename.tablename TO 'username'@'host' WITH GRANT OPTION;
View user authorization
SHOW GRANTS FOR 'username'@'%'
Set and change user passwords
SET PASSWORD FOR 'username'@' Appoint ip' = PASSWORD(' password ');
If it is the current login user, you can directly use :
SET PASSWORD = PASSWORD(" password ");
Example :
SET PASSWORD FOR 'username'@'%' = PASSWORD("123456");
Revoke user privileges
REVOKE privilegexxx ON databasename.tablenamexxx FROM 'username'@' Appoint ip';
Example :
REVOKE SELECT ON *.* FROM 'username'@'%'; # revoke SELECT jurisdiction
Be careful :
If you give users 'username'@'%' The authorized command is ( Or similar ):GRANT SELECT ON test.user TO 'username'@'%', So use REVOKE SELECT ON *.* FROM 'username'@'%' The command does not undo the user pair test In the database user Tabular SELECT operation . contrary , If authorized to use is GRANT SELECT ON *.* TO 'username'@'%'; that REVOKE SELECT ON test.user FROM 'username'@'%' The command also cannot undo the user pair test In the database user Tabular Select jurisdiction .
Delete user
DROP USER 'username'@' Appoint ip'; -- Mode one
delete from mysql.user where user="username"; -- Mode two
边栏推荐
- Paper recommendation: relicv2, can the new self supervised learning surpass supervised learning on RESNET?
- MySQL创建用户并授权
- What is the commonly heard sub table of MySQL? Why does MySQL need tables?
- Computer configuration suggestions for learning modeling
- 微信小程序项目实例——我有一支画笔(画画)
- 大整数的加与乘;
- 2022 communication industry ultimate Exhibition Guide
- 顺序表与链表---初阶
- Youcans' opencv lesson - 10 Image restoration and reconstruction
- How do I make the mouse wheel work in the VB6 ide- How can I make mousewheel work in VB6 IDE?
猜你喜欢

mysql/oracle 以唯一时间为分界,小于等于该时间求和,大于该时间求和

微信小程序项目实例——体质计算器

【点云压缩】Variational Image Compression with A Scale Hyperprior

分數大小的比較

The idea of setting the flash memory management and resource size, and the quantitative relationship among parallelism, slot, and taskmanager quantity

1186_ Accumulation of embedded hardware knowledge_ Triode and three electrodes

Redis gets the set of keys prefixed with XXX

Requirements and business model analysis requirements 13 data modeling

How to prevent electrical fire in shopping malls?
![What is a request response pair called? [repeat] - what is a request response pair called? [duplicate]](/img/65/a214d137e230b1a1190feb03660f2c.jpg)
What is a request response pair called? [repeat] - what is a request response pair called? [duplicate]
随机推荐
Go recursive infinite classification
The idea of setting the flash memory management and resource size, and the quantitative relationship among parallelism, slot, and taskmanager quantity
mysql/oracle 以唯一时间为分界,小于等于该时间求和,大于该时间求和
2020-12-12
2020-12-10
微信小程序项目实例——双人五子棋
How to modify the result name of MySQL query result 1 and result 2
余压监控系统在高层民用建筑的应用
2020-12-06
Wechat applet project example - renju for two
Exemple de projet d'applet Wechat - calculatrice de constitution
3769 moving stones (simulated)
Laravel 8 selects JWT for interface verification
AcrelCloud-6000安全用电云平台在某商业广场的应用
[string] determine whether S2 is the rotation string 2 of S1
顺序表与链表-----进阶
Sequence list and linked list ----- advanced
Demand and business model innovation - demand 10- observation and document review
【点云压缩】Variational Image Compression with A Scale Hyperprior
Demand and business model innovation - demand 11 - overview of demand analysis