Example analysis of mysql user rights management

Example analysis of mysql user rights management

This article describes the MySQL user rights management example. Share with you for your reference, the details are as follows:

In this article:

  • What are user permissions?
  • Appropriate user permissions
  • View permissions
  • Modify permissions
  • Remove permissions

Release date: 2018-04-19


What are user permissions:

  • Each user has his or her own user permissions, such as query table permissions, modify table permissions, insert table permissions, add new user permissions, etc.
  • Specific permissions: image


Appropriate user permissions:

  • Most users only need to read and write tables, but a few users even need to be able to create and delete tables;
  • Some users need to read the table but may not need to update the table;
  • For most users, only read and write access to tables should be provided , and they should not be allowed to create, modify, or delete tables.
  • For most users, they should not be given the permission to create, modify or delete other users . Instead, only administrators should have such permission.
  • For most users, the ability to modify user permissions should not be given, and should only be given to administrators.
  • other. . .


View permissions:

  • show grants for username@host address; [If the user's login address is %, you can leave the login address blank]
    • image
  • You can also view permissions by viewing user information: select * from user \G
    • The priv field in the user information table represents various permissions. A value of N means no permission, and a value of Y means permission.


Modify permissions:

  • Grant permissions: grant permissions on database name.data table to username@accessible address; [If the user's accessible address is %, you can leave the accessible address blank]
    • The new permissions granted will be compared with the original ones, and those in the same database will be merged image
    • You can grant multiple permissions at the same time, separated by commas: image
  • Refresh privileges: flush privileges; [The modified user permissions will not take effect immediately. If you want them to take effect immediately, you need to refresh the permissions]

Permissions that can be granted (refer to mysql must know):

image

image


To remove permissions:

  • Delete permission: revoke permission on database name.data table from user name@accessible address; [if the user's accessible address is %, the accessible address can be left blank]
    • image
    • image

Readers who are interested in more MySQL-related content can check out the following topics on this site: "MySQL query skills", "MySQL transaction operation skills", "MySQL stored procedure skills", "MySQL database lock related skills summary" and "MySQL common function summary"

I hope this article will be helpful to everyone's MySQL database design.

You may also be interested in:
  • Detailed explanation of MySQL user rights management
  • Detailed explanation of MySQL user rights management
  • Implementation of Mysql User Rights Management

<<:  Vue+Openlayer batch setting flash point implementation code (based on postrender mechanism)

>>:  CentOS uses expect to remotely execute scripts and commands in batches

Recommend

JavaScript color viewer

This article example shares the specific code of ...

Common writing examples for MySQL and Oracle batch insert SQL

Table of contents For example: General writing: S...

Configure Mysql master-slave service implementation example

Configure Mysql master-slave service implementati...

The specific use and difference between attribute and property in Vue

Table of contents As attribute and property value...

A brief discussion on how to elegantly delete large tables in MySQL

Table of contents 1. Truncate operation 1.1 What ...

How to solve the synchronization delay caused by MySQL DDL

Table of contents Preface Solution Tool Introduct...

Do you know the difference between empty value and null value in mysql

Preface Recently I found that my friend's met...

Detailed explanation of redo log and undo log in MySQL

The most important logs in the MySQL log system a...

Introduction to installing and configuring JDK under CentOS system

Table of contents Preface Check and uninstall Ope...

Solution for Docker container not recognizing fonts such as Songti

Problem background: When using docker to deploy t...

Example code of CSS layout at both ends (using parent's negative margin)

Recently, during the development process, I encou...

Vue implements countdown function

This article example shares the specific code of ...