当前位置:网站首页>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
边栏推荐
- Deep learning notes - semantic segmentation and data sets
- JS engine loop mechanism: synchronous, asynchronous, event loop
- DIY is an excel version of subnet calculator
- Uglifyjs compress JS
- JS détermine si la chaîne de nombres contient des caractères
- Perfect test of coil in wireless charging system with LCR meter
- Sword finger offer: symmetric binary tree (recursive iteration leetcode 101)
- Day. JS common methods
- Implementation of switching windows and capturing data in selenium mode
- Golang select priority execution
猜你喜欢

多线程基本概念(并发与并行、线程与进程)和入门案例
![[WinUI3]编写一个仿Explorer文件管理器](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[WinUI3]编写一个仿Explorer文件管理器

MySQL -- execution process and principle of a statement

Discussion on flow restriction

DIY is an excel version of subnet calculator

泰克示波器DPO3054自校准SPC失败维修

Leetcode 1547: minimum cost of cutting sticks

Data security has become a hidden danger. Let's see how vivo can make "user data" armor again

AQS source code reading
![[winui3] Écrivez une copie du gestionnaire de fichiers Explorer](/img/3e/62794f1939da7f36f7a4e9dbf0aa7a.png)
[winui3] Écrivez une copie du gestionnaire de fichiers Explorer
随机推荐
configmap
AQS源码阅读
Sword finger offer: the median in the data stream (priority queue large top heap small top heap leetcode 295)
What are instruction cycles, machine cycles, and clock cycles?
Acid of MySQL transaction
C list field sorting contains numbers and characters
[database] MySQL basic operation (basic operation ~)
【数据库】MySQL单表查询
Machine learning - linear regression
Set Chrome browser background to eye protection (eye escort / darkreader plug-in)
Learning Android from scratch -- baseactivity and activitycollector
Other problems encountered in debugging fingerprints
使用zerotier让异地设备组局域网
[database] MySQL single table query
Detailed explanation of hregionserver
机器学习---线性回归
Redis lost key and bigkey
Locks and transactions in MySQL
Sword finger offer: push in and pop-up sequence of stack
Innovation training (XI) airline ticket crawling company information