博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mysql用户权限_MySQL用户权限
阅读量:2512 次
发布时间:2019-05-11

本文共 2696 字,大约阅读时间需要 8 分钟。

mysql用户权限

Let’s see how to grant permissions (called privileges) to a user of the MySQL database

让我们看看如何向MySQL数据库的用户授予权限(称为特权)

By default when you create a new MySQL user using the syntax

默认情况下,当您使用语法创建新MySQL用户时

CREATE USER '
'@'localhost' IDENTIFIED BY '
';

the user cannot do much. We can say that it can’t to anything, actually.

用户不能做太多事情。 我们可以说实际上什么也做不了。

It can’t read data from any existing database, let alone modifying the data. And it can’t even create a new database.

它无法从任何现有数据库读取数据,更不用说修改数据了。 而且它甚至无法创建新的数据库。

To make a user do anything, you have to grant privileges to it.

要使用户执行任何操作,您必须为其授予特权

You can do so using the GRANT command.

您可以使用GRANT命令执行此操作。

We can use GRANT <permission>, using the following permission keywords:

我们可以使用GRANT <permission> ,并使用以下权限关键字:

  • CREATE

    CREATE

  • DROP

    DROP

  • DELETE

    DELETE

  • INSERT

    INSERT

  • SELECT

    SELECT

  • UPDATE

    UPDATE

  • ALL PRIVILEGES

    ALL PRIVILEGES

向用户授予创建新数据库的特权 (Give privilege to create new databases to a user)

GRANT CREATE ON *.* TO '
'@'localhost';

授予用户特权以在特定数据库中创建新表 (Give privileges to a user to create new tables in a specific database)

GRANT CREATE ON 
.* TO '
'@'localhost';

授予向用户读取(查询)特定数据库的特权 (Give privilege to read (query) a specific database to a user)

GRANT SELECT ON 
.* TO '
'@'localhost';

向用户授予读取特定数据库表的特权 (Give privilege to read a specific database table to a user)

GRANT SELECT ON 
.
'@'localhost';
TO '

向用户授予在特定数据库中插入,更新和删除行的特权 (Give privilege to insert, update and delete rows in a specific database to a user)

GRANT INSERT, UPDATE, DELETE ON 
.* TO '
'@'localhost';

向用户授予删除特定数据库中表的特权 (Give privilege to delete tables in a specific database to a user)

GRANT DROP ON 
.* TO '
'@'localhost';

向用户授予删除数据库的特权 (Give privilege to delete databases to a user)

GRANT DROP ON *.* TO '
'@'localhost';

将特定数据库的所有特权授予用户 (Give all privilege on a specific database to a user)

GRANT ALL PRIVILEGES ON 
.* TO '
'@'localhost';

授予用户所有特权 (Give all privileges to a user)

GRANT ALL PRIVILEGES ON *.* TO '
'@'localhost';

撤销特权 (Revoke a privilege)

Example to revoke the DROP privilege on <database>:

撤销<database>上的DROP特权的示例:

REVOKE DROP ON 
.* TO '
'@'localhost';

To revoke all privileges, run:

要撤消所有特权,请运行:

REVOKE ALL PRIVILEGES ON *.* TO '
'@'localhost';


You can visualize the privileges of a single user by running:

您可以通过运行以下命令来可视化单个用户的特权:

SHOW GRANTS FOR '
'@'localhost';

翻译自:

mysql用户权限

转载地址:http://ovqgb.baihongyu.com/

你可能感兴趣的文章
Robberies
查看>>
get post 提交
查看>>
PC和HOST之间文件传送
查看>>
R安装
查看>>
Next Permutation
查看>>
python菜鸟基础知识(二)
查看>>
Jquery 飘窗
查看>>
mysql 效率 inner join 与 where in
查看>>
linux 定时任务详解
查看>>
PowerShell 远程管理之 about_Remote_Troubleshooting
查看>>
创建Windows服务(Windows Services)N种方式总结
查看>>
Inno Setup入门(五)——添加readme文件
查看>>
openCv学习札记(二)—cv:Mat学习
查看>>
图像处理之哈哈镜的实现
查看>>
跟我一起学C++
查看>>
Android Studio Gradle
查看>>
网络中的「动态路由算法」,你了解吗?
查看>>
html5新特性
查看>>
Effective Java 阅读笔记——枚举和注解
查看>>
Android自动化测试之环境搭建
查看>>