当前位置:网站首页>MySQL basics 3
MySQL basics 3
2022-04-23 05:07:00 【Write poetry for you@】
-
understand mysql
- Add new users
- Modify user rights
- Change user password
- Query the user
- Delete user
1. In essence, a database is a folder , Tables are files
2. establish user user1( new user )
create user 'user1'@'localhost' identified by '123456';
Installed mysql There is 4 individual user user , user1 It's a new user
Let's use this user link again
View the... Under this user database ( only one ,rooot Initially, there are four databases under the user )
3. Change user name Or code
Let's change the user name first
rename user 'user1'@'localhost' to 'user2' @'localhost';
adopt mysql.user This table query mysql Users in become use2 了
Changing the user's password
alter user 'user2'@'localhost' identified by '654321';
Be careful After revising user2 After this user name and password , Log in and change your password 654321
4. Modify user rights , Log in root User's permission to modify other protection , Or modify the user's permission under the user
ps: Add permissions to users , Or after revoking the permission , Need to reopen cmd, link mysql Check the code effect
privileges: User permissions
* Yes select,update,indert,delete etc. , If granted in full, you can use all
Refresh user rights flush privileges
grant privileges on database_name.table_name to 'user_name' @'host'
for example :1
grant all on *.* to 'user1'@'localhost'; // The table is for the user user1 to grant authorization , Give Way user1 Give all library and table operations to this machine , It feels like root And user1 Users operate some libraries together
2. grant select,insert on cesi.student to 'user1'@'localhost';
// To the user use1 to grant authorization , Give Way user1 can cesi In the library student surface implement select Query and insert operations
The following is to revoke the permission of so and so user Be careful (from) Adding permissions is to
revoke jurisdiction on Database name . Table name from' user name '@' Host name '
privileges: User permissions
* Yes select,update,indert,delete etc. , If granted in full, you can use all
revoke all on *.* from 'user1'@'localhost'; This cancels user1 User's operation authority on all databases , Except for the original one
ps: all All permissions ( Additions and deletions ) *.* Represents all libraries and tables
ps: Here is user1 user There is no database that can be operated before revoking
5. Query the user
stay mysql Under the user , adopt mysql.user Table query
select user,host from mysql.user;
6. Delete a user , It is not recommended to test root user , Delete... Here user2
First log in to any user , operation , drop user 'xxx user name '@' Host name '
版权声明
本文为[Write poetry for you@]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220549552436.html
边栏推荐
- Streamexecutionenvironment of Flink source code
- 用LCR表完美测试无线充电系统中的线圈
- Sword finger offer: the median in the data stream (priority queue large top heap small top heap leetcode 295)
- 2022/4/22
- The vscode ipynb file does not have code highlighting and code completion solutions
- QPushbutton 槽函数被多次触发
- [database] MySQL basic operation (basic operation ~)
- The difference between static pipeline and dynamic pipeline
- In aggregated query without group by, expression 1 of select list contains nonaggregated column
- redis数据类型有哪些
猜你喜欢
DIY 一个 Excel 版的子网计算器
使用zerotier让异地设备组局域网
[database] MySQL single table query
Discussion on flow restriction
深度学习笔记 —— 物体检测和数据集 + 锚框
2022/4/22
The 2021 more reading report was released, and the book consumption potential of post-95 and Post-00 rose
用LCR表完美测试无线充电系统中的线圈
Innovation training (IX) integration
The WebService interface writes and publishes calls to the WebService interface (2)
随机推荐
Field injection is not recommended using @ Autowired
直播带货表格模板-自动显示图片-自动关联系列商品
Leetcode -- heuristic search
[2021] Spatio-Temporal Graph Contrastive Learning
Informatics Olympiad 1955: [11noip popularization group] Swiss round | openjudge 4.1 4363: Swiss round | Luogu p1309 [noip2011 popularization group] Swiss round
Restful toolkit of idea plug-in
Innovation training (VI) routing
Progress of innovation training (IV)
Uglifyjs compress JS
Acid of MySQL transaction
Independent station operation | Facebook marketing artifact - chat robot manychat
L2-011 play binary tree (build tree + BFS)
Mac enters MySQL terminal command
[database] MySQL single table query
Deep learning notes - object detection and dataset + anchor box
C. Tree infection (simulation + greed)
Set Chrome browser background to eye protection (eye escort / darkreader plug-in)
The 8 diagrams let you see the execution sequence of async / await and promise step by step
C list field sorting contains numbers and characters
Innovation training (IX) integration