which privileges should be set for website database user / client in mysql

谁都会走 提交于 2019-12-10 21:49:09

问题


So what privileges should be set for the mysql user that is to be used as 'main' user for the website?

I'm thinking data and structure ( see below ) for the database that is used should be set. But do i need to add administration rights also? And would this be any different if you own a web server and grant privileges to a client that for example want you to host an website for them giving them rights to use phpmyadmin on there own databases.

Data

SELECT
INSERT
UPDATE
DELETE
FILE 

Structure

CREATE
ALTER
INDEX
DROP
CREATE TEMPORARY TABLES
SHOW VIEW
CREATE ROUTINE
ALTER ROUTINE
EXECUTE
CREATE VIEW
EVENT
TRIGGER 

Administration

GRANT
SUPER
PROCESS
RELOAD
SHUTDOWN
SHOW DATABASES
LOCK TABLES
REFERENCES
REPLICATION CLIENT
REPLICATION SLAVE
CREATE USER 

回答1:


For a website user (that your application uses to connect to your database) simple SELECT, INSERT, UPDATE, DELETE rights should be enough. In most situations, your website should not really modify the structure of your tables (that might indicate bad database design). You only want to deal with data here.

If you are talking about a user that also needs to modify structural things, design and create tables, like one used for phpMyAdmin, you certainly need the Data and Structure rights. No Administration I'd say.



来源:https://stackoverflow.com/questions/9030888/which-privileges-should-be-set-for-website-database-user-client-in-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!