Home  >  Article  >  Database  >  Simple database permission assignment tutorial

Simple database permission assignment tutorial

小云云
小云云Original
2017-11-20 16:57:091318browse

A database is a collection of data organized according to a certain data model and stored in secondary storage. This kind of data collection has the following characteristics: it is as non-duplicated as possible, serves multiple applications of a specific organization in an optimal way, its data structure is independent of the applications that use it, and it has the ability to add, delete, modify, and query data. Unified software for management and control. From the perspective of development history, database is an advanced stage of data management, which was developed from file management system.

This article will teach you a simple tutorial on establishing a database and assigning permissions.

(1) Create a new database travel_db

CREATE DATABASE `travel_db` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

(2) Create a new user travelUser1, only allow this user to access travel_db library

create user `travelUser1`;

update mysql.user set password=password('pwd123#.O') where User='travelUser1';

flush privileges;

show grants for `travelUser1`;

grant select,update,delete,insert on travel_db.* to `travelUser1`;

flush privileges;

show grants for `travelUser1`;

(3) Set rijiAppUser to be able to perform all operations on the travel_db library

flush privileges;

grant all on travel_db.* to `travelUser1`;

show grants for `travelUser1`;

How about it? It’s very simple. Beginners can give it a try.

Related recommendations:

Implementation code based on php permission allocation

Implementation code based on php permission allocation_php example

MySQL permission allocation

The above is the detailed content of Simple database permission assignment tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn