MySQL用户创建数据库需要什么权限? [英] What permission is required for a MySQL user to create a database?

查看:1259
本文介绍了MySQL用户创建数据库需要什么权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除root以外的其他用户是否可以创建数据库?

Is it possible for a user other than root to create a database?

 GRANT SELECT, CREATE ON *.* TO 'myguy'@'thatmachine' IDENTIFIED BY PASSWORD '*12057DFA2BFBD8760D4788735B1C3E26889D7ECE' |
 GRANT ALL PRIVILEGES ON `db1`.* TO 'myguy'@'thatmachine'
 GRANT ALL PRIVILEGES ON `db2`.* TO 'myguy'@'thatmachine'

我想知道这里缺少什么特权?另外,为什么第一行附加了密码?

I wonder what privilege is missing here? Also, why does the first line have a password attached to it?

更新

让我进一步澄清我的问题是什么.我有两个数据库机器,源机器和目标机器.源计算机上有许多客户数据库.我需要将这些源数据库移到另一台目标计算机上.

Let me further clarify what the point of my question is. I have two database machines, source and target. There are many customer databases on the source machine. I need to move those source databases to the other target machine.

数据库采用mysqldump格式的.sql文件的形式,这些文件从源sftp到目标.然后,目标用户(不是root用户)必须从每个.sql文件在本地重新创建数据库,执行一些操作,然后删除数据库.

The databases are in the form of mysqldump'ed .sql files, which are sftp'd from source to target. Target user, not root, must then recreate the databases locally from each .sql file, perform some actions, then drop the database.

如果不给目标用户授予*.*上的全局特权,我无法找到将这些特权授予目标用户的方法,这实际上使该用户像root一样危险.

I can't find a way to give these privileges to the target user without giving him global privileges on *.*, which effectively makes that user as dangerous as root.

推荐答案

绝对可以. http://dev.mysql.com/doc/refman /5.1/zh-CN/privileges-provided.html#priv_create

这篇关于MySQL用户创建数据库需要什么权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆