MySQL权限分配_MySQL
MySQL的权限系统围绕着两个概念:
1:认证->确定用户是否允许连接数据库服务器
2:授权->确定用户是否拥有足够的权限执行查询请求等。
显然从上面可知,如果认证不成功的话,哪么授权肯定是无法进行的。在这里我们要关注两个表,分别是在MySQL数据库中user表和db表。
user表在某种程度上是独一无二的,因为它是唯一一个在权限请求的认证和授权阶段都起作用的表,也是唯一一个存数MySQL服务器相关权限的权限表。在认证阶段,它只是负责为用户授权访问MySQL服务器,确定用户每小时的最大连接数和最大并发数;在授权阶段,user确定允许访问服务器的用户是否被赋予了操作数据库的全局权限,确定用户每小时的最大查询数和更新数。
db表用于为每个用户针对每个数据库赋予权限。具体的可以查看db的字段。
用户和权限管理命令:
create user :用于创建新的用户账户(从5.0版本开始有这个命令),在创建这个用户的时候不分配任何权限,需要在创建之后通过grant命令来给改用户分配相应的权限。
eg:create user guest@localhost identified by '123456';
grant select on mydb.* to guest@localhost;
drop user:删除一个用户账户(注意在4.1.1版本之前只能删除没有任何权限的账户,5.0.2之后可以删除任何账户)
eg:drop user guest;
rename user:可以实现重命名一个用户账号。
grant:用于管理访问权限,也就是给用户账号授权。当然它同样可以创建一个新的用户账户。
eg:grant select, insert, update, delete on new_db.* to guest@'%' identified by '88888888';
grant 权限 on 数据库.表 to 用户 @ 访问方式 identified by 密码
grant select on mydb.* to guest@localhost identified by '123456';
BTW:如果需要一个空密码或者无密码的账户,必须先用Create User命令,然后通过
grant来分配权限。如果如下操作:
grant all privileges on mydb.* to visitor@'%' ;而在数据库user表中没有先创建visitor
用户,则会发生1133错误"Can't find any matching row in the user table"。grant只能创
有密码的账户。revoke:删除一个账户,具体查看MySQL的文档。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



1.1.1.1 Login method for the Internet authentication system: 1. Search for the campus network wireless signal and connect; 2. Open the browser and select "Self-Service" on the pop-up authentication interface; 3. Enter the user name and initial password to log in; 4. Complete Personal information and set a strong password.

JWT (JSONWebToken) is a lightweight authentication and authorization mechanism that uses JSON objects as security tokens to securely transmit user identity information between multiple systems. ThinkPHP6 is an efficient and flexible MVC framework based on PHP language. It provides many useful tools and functions, including JWT authentication mechanism. In this article, we will introduce how to use ThinkPHP6 for JWT authentication to ensure the security and reliability of web applications

The difference between WeChat public account authentication and non-authentication lies in the authentication logo, function permissions, push frequency, interface permissions and user trust. Detailed introduction: 1. Certification logo. Certified public accounts will obtain the official certification logo, which is the blue V logo. This logo can increase the credibility and authority of the public account and make it easier for users to identify the real official public account; 2. Function permissions. Certified public accounts have more functions and permissions than uncertified public accounts. For example, certified public accounts can apply to activate the WeChat payment function to achieve online payment and commercial operations, etc.

KC certification is to enable consumers to more clearly understand the certification mark marked on the products they purchase. It is a national unified certification mark that is used to reduce the various certification fees borne by product manufacturers. The Korea Institute of Technical Standards (KATS) announced on August 20, 2008 that it would implement KC certification from July 2009 to December 2010.

OCJP certification is divided into several levels. The entry-level OCA covers the basics of Java programming, and the advanced OCP covers more in-depth concepts. In addition, there are certifications covering specific Java versions, such as OCA/OCPJavaSE1Z0-808/1Z0-809 and its updated version 11Programmer. Earned by studying, practicing and taking exams, OCJP certification demonstrates skills, enhances career prospects and drives continued development.

Understanding Web Interface Authentication and Permission Management on Linux Servers With the rapid development of the Internet, Web applications are becoming more and more common in enterprise and personal use. In order to protect the security and confidentiality of web applications, authentication and permission management have become very important. On a Linux server, implementing Web interface authentication and permission management is a key task. This article will introduce how to perform Web interface authentication and permission management on Linux servers, helping you build safe and reliable Web applications. 1. Recognize

As a high-quality travel app, Ctrip can arrange travel services for users, so that users do not have to be embarrassed by the inconvenience of travel. Among them, student users can also enjoy discounts in this app, just through After student certification, you can enjoy preferential travel. So how to verify the student discount in the Ctrip travel app? This tutorial guide will bring you a detailed guide introduction. I hope it can help everyone in need. . First of all, in Ctrip Travel, we find student rights on my page, then select the student certification rights on Ctrip campus to find the option to upgrade immediately. Then on the student ID certification page, fill in your relevant information, and then upload your student To verify your documents, click to confirm immediately

With the development of the Internet, more and more applications and services require mobile phone number authentication to ensure the authenticity and security of users. In the PHP language, it has become easier and more convenient to implement the phone number authentication function. This article will introduce how to use PHP to implement phone number authentication function. 1. Use regular expressions for basic phone number verification. In China, phone numbers come in various formats, but they generally consist of 11 digits. Therefore, we can use regular expressions to perform basic verification of phone numbers. p in PHP
