当前位置:网站首页>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
边栏推荐
- Wine (COM) - basic concept
- DIY is an excel version of subnet calculator
- Repair of self calibration SPC failure of Tektronix oscilloscope dpo3054
- Leetcode 1547: minimum cost of cutting sticks
- [2021] Spatio-Temporal Graph Contrastive Learning
- 2022/4/22
- Chapter III project schedule management of information system project manager summary
- js 判斷數字字符串中是否含有字符
- Implementation of switching windows and capturing data in selenium mode
- Thoughts on a small program
猜你喜欢
![[WinUI3]編寫一個仿Explorer文件管理器](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[WinUI3]編寫一個仿Explorer文件管理器

Innovation training (IX) integration
![[database] MySQL single table query](/img/27/99d174219109ea7a455cfdf55e0996.png)
[database] MySQL single table query

Restful toolkit of idea plug-in

MySQL - index

Cross border e-commerce | Facebook and instagram: which social media is more suitable for you?

Deep learning notes - fine tuning

Discussion on flow restriction

Live delivery form template - automatically display pictures - automatically associate series products

The WebService interface writes and publishes calls to the WebService interface (2)
随机推荐
独立站运营 | FaceBook营销神器——聊天机器人ManyChat
Details related to fingerprint payment
Innovation training (XI) airline ticket crawling company information
API slow interface analysis
Basic theory of Flink
The applet calls the function of scanning QR code and jumps to the path specified by QR code
vscode ipynb文件没有代码高亮和代码补全解决方法
C list field sorting contains numbers and characters
js 判斷數字字符串中是否含有字符
Innovation training (II) task division
深度学习笔记 —— 物体检测和数据集 + 锚框
深度学习笔记 —— 语义分割和数据集
2022/4/22
[2021] Spatio-Temporal Graph Contrastive Learning
How to exit VIM
HRegionServer的详解
C. Tree Infection(模拟+贪心)
Redis lost key and bigkey
Knowledge points sorting: ES6
MySQL 慢查询