grant create database privilege to mariadb user(向 mariadb 用户授予创建数据库权限)
问题描述
我知道在数据库管理中,使用 root 用户是一种不好的行为,我正在设置一个具有基本权限的自定义用户(创建数据库、删除数据库、对所有新创建的数据库的所有访问权限等).
我创建了一个用户 antoine
,它应该是用于登录 mariadb 服务器
的基本用户.
I know that in database management, it's a bad behavior to use the root user and I'm setting up a custom user with base privileges (create database, drop db, all access to all newly created dbs, etc).
I've created a user antoine
which should be the base user used to login to the mariadb server
.
问题是,我不知道如何授予管理权限,如 create database xxx
、drop database xxx
等...文档解释说授予一个特权,你运行以下命令:
Problem is, I can't figure out how to grant administration privileges like create database xxx
, drop database xxx
, etc... The documentation explains that to grant a privilege, you run the following command:
GRANT role ON database.table TO user@host
但是,当涉及到服务器权限时,我该怎么做呢?我试过 *.*
而不是 database.table
但它不起作用.
But, when it comes to server privileges, how can I do it ? I've tried the *.*
instead of database.table
but it's not working.
推荐答案
创建一个用户,然后授予该用户您希望他们拥有的权限.
Create a user and then grant that user the privileges you want them to have like this.
CREATE USER 'antoine'@'localhost' IDENTIFIED VIA mysql_native_password USING 'a-password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON *.* TO 'antoine'@'localhost';
这篇关于向 mariadb 用户授予创建数据库权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:向 mariadb 用户授予创建数据库权限


基础教程推荐
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01