Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize user account Management by MySQL

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "MySQL how to achieve user account management", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "MySQL how to achieve user account management" this article.

MySQL user account Management 1.MySQL username and password

Users are stored in the user table of the mysql database in MySQL, an account is defined based on a user name and client host or host name connected to the server, this account also has a password, and more information is queried in the user table.

two。 Add user account

Two ways to create a MySQL account

Create an account using a statement: CREATE USER or GRANT

Create a user

Mysql > CREATE USER 'monty'@'localhost' IDENTIFIED BY' some_pass'

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'monty'@'localhost'

-> WITH GRANT OPTION

Mysql > CREATE USER 'monty'@'%' IDENTIFIED BY' some_pass'

Mysql > GRANT ALL PRIVILEGES ON *. * TO 'monty'@'%'

-> WITH GRANT OPTION

Mysql > CREATE USER 'admin'@'localhost'

Mysql > GRANT RELOAD,PROCESS ON *. * TO 'admin'@'localhost'

Mysql > CREATE USER 'dummy'@'localhost'

Grant select,insert,update,delete on dbname.* to 'monty'@'%'

Grant create,alter,drop,index,show view,create routine,alter routine,execute,create view, event,trigger on dbname.* to 'monty'@'%'

Mysql permission list

Authority

Permission level

Permission description

CREATE

Database, table, or index

Create database, table, or index permissions

DROP

Database or table

Delete database or table permissions

GRANT OPTION

A database, table, or saved program

Give permission option

REFERENCES

Database or table

ALTER

Table

Change tables, such as adding fields, indexes, etc.

DELETE

Table

Delete data permissions

INDEX

Table

Index permission

INSERT

Table

Insert permission

SELECT

Table

Query permission

UPDATE

Table

Update permissions

CREATE VIEW

View

Create view permissions

SHOW VIEW

View

View view permissions

ALTER ROUTINE

Stored procedure

Change stored procedure permissions

CREATE ROUTINE

Stored procedure

Create stored procedure permissions

EXECUTE

Stored procedure

Execute stored procedure permissions

FILE

File access on the server host

File access permission

CREATE TEMPORARY TABLES

Server management

Create temporary table permissions

LOCK TABLES

Server management

Lock table permission

CREATE USER

Server management

Create user permissions

PROCESS

Server management

View process permissions

RELOAD

Server management

Permission to execute flush-hosts, flush-logs, flush-privileges, flush-status, flush-tables, flush-threads, refresh, reload, etc.

REPLICATION CLIENT

Server management

Copy permission

REPLICATION SLAVE

Server management

Copy permission

SHOW DATABASES

Server management

View database permissions

SHUTDOWN

Server management

Turn off database permissions

SUPER

Server management

Execute kill thread permissions

Set password

Mysql > SET PASSWORD FOR

-> 'jeffrey'@'localhost' = PASSWORD (' mypass')

Mysql > SET PASSWORD = PASSWORD ('mypass')

Delete user

DROP USER 'jeffrey'@'localhost'

The above is all the contents of the article "how to manage user accounts in MySQL". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report