grant

MySQL grant all privileges to database except one table

自闭症网瘾萝莉.ら 提交于 2019-11-26 20:26:58
I've been unable to find a reasonable solution to achieve the following: I wish to have a user that has ALL privileges on a database (or series of databases with the same schema), except for one table, to which they will only have SELECT privileges. Essentially I want the user to have free reign over a database but not to be able to update a specific table. So far I have tried, to no avail: Granting all privileges on that database (db_name.*) and then specifically granting only select privileges on that desired table (hoping it would overwrite the "all", stupid I know). Granting all privileges

How can I restrict a MySQL user to a particular tables

╄→гoц情女王★ 提交于 2019-11-26 20:11:53
问题 How can I restrict a user_account in MySQL database to a particular tables. Ex: UserName: RestrictedUser DatabaseName: db_Payroll TableName: tb_Employees tb_Users tb_Payroll_YYMMDD tb_Payroll_Processed I want to restrict "RestrictedUser" to tb_Users and tb_Employees only and the rest of the tables of db_Payroll that will be created for future use is granted to have access. 回答1: Assuming the user has no current privileges, you can do the following GRANT SELECT, INSERT, DELETE ON db_Payroll.tb

How to grant all privileges on views to arbitrary user

*爱你&永不变心* 提交于 2019-11-26 20:10:05
问题 How do you grant read/select access on all functions and views to an arbitrary user? I use psql --user=postgres -d mydb -f myview.sql to create several functions and views, and then I run: GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser; Having been granted all privileges, I would expect myuser to now have access to the functions and views created by the postgres user. However, when I try and access them with myuser , I get a "permission denied for relation..." error. Why is this? 回答1: The

Permission denied for relation

大憨熊 提交于 2019-11-26 19:14:29
I tried to run simple sql command: select * from site_adzone; and I got this error ERROR: permission denied for relation site_adzone What could be the problem here? I tried also to do select for other tables and got same issue. I also tried to do this: GRANT ALL PRIVILEGES ON DATABASE jerry to tom; but I got this response from console WARNING: no privileges were granted for "jerry" Do you have some idea what can be wrong? GRANT on the database is not what you need. Grant on the tables directly. Granting privileges on the database mostly is used to grant or revoke connect privileges. This

Grant all on a specific schema in the db to a group role in PostgreSQL

喜欢而已 提交于 2019-11-26 18:30:16
Using PostgreSQL 9.0, I have a group role called "staff" and would like to grant all (or certain) privileges to this role on tables in a particular schema. None of the following work GRANT ALL ON SCHEMA foo TO staff; GRANT ALL ON DATABASE mydb TO staff; Members of "staff" are still unable to SELECT or UPDATE on the individual tables in the schema "foo" or (in the case of the second command) to any table in the database unless I grant all on that specific table. What can I do make my and my users' lives easier? Update: Figured it out with the help of a similar question on serverfault.com .

MySQL创建用户和授权

可紊 提交于 2019-11-26 18:24:39
MySQL创建用户和授权 权限管理 我们知道我们的最高权限管理者是root用户,它拥有着最高的权限操作。包括select、update、delete、update、grant等操作。那么一般情况在公司之后DBA工程师会创建一个用户和密码,让你去连接数据库的操作,并给当前的用户设置某个操作的权限(或者所有权限)。那么这时就需要我们来简单了解一下: 如何创建用户和密码 给当前的用户授权 移除当前用户的权限 如果你想创建一个新的用户,则需要以下操作: 进入到mysql数据库下 mysql> use mysql Database changed 对新用户增删改 1.创建用户: # 指定ip:192.118.1.1的mjj用户登录 create user 'alex'@'192.118.1.1' identified by '123'; # 指定ip:192.118.1.开头的mjj用户登录 create user 'alex'@'192.118.1.%' identified by '123'; # 指定任何ip的mjj用户登录 create user 'alex'@'%' identified by '123'; 2.删除用户 drop user '用户名'@'IP地址'; 3.修改用户 rename user '用户名'@'IP地址' to '新用户名'@'IP地址'; 4.修改密码

Correct way to give users access to additional schemas in Oracle

好久不见. 提交于 2019-11-26 16:05:38
问题 I have two users Bob and Alice in Oracle, both created by running the following commands as sysdba from sqlplus: create user $blah identified by $password; grant resource, connect, create view to $blah; I want Bob to have complete access to Alice's schema (that is, all tables), but I'm not sure what grant to run, and whether to run it as sysdba or as Alice. Happy to hear about any good pointers to reference material as well -- don't seem to be able to get a good answer to this from either the

How to grant remote access to MySQL for a whole subnet?

妖精的绣舞 提交于 2019-11-26 15:22:54
问题 I can easily grant access to one IP using this code: $ mysql -u root -p Enter password: mysql> use mysql mysql> GRANT ALL ON *.* to root@'192.168.1.4' IDENTIFIED BY 'your-root-password'; mysql> FLUSH PRIVILEGES; But i need to allow the whole subnet 192.168.1.* to access the database remotely. How can i do that? 回答1: EDIT: Consider looking at and upvoting Malvineous's answer on this page. Netmasks are a much more elegant solution. Simply use a percent sign as a wildcard in the IP address. From

MySQL 5.7数据库应用管理实战(一)

♀尐吖头ヾ 提交于 2019-11-26 13:29:12
1 修改mysql数据库的提示符 1.1 临时修改mysql登陆提示符,session结束后失效 mysql> prompt \u@\h [\d] \r:\m:\s-> PROMPT set to '\u@\h [\d] \r:\m:\s->' root@localhost [(none)] 09:18:10->\q 1.2 永久修改mysql登陆提示符 在my.cnf配置文件中,[mysql]模块下添加如下内容(注意,不是[mysqld])保存后,无需重启MySQL,退出当前session,重新登陆即可;如果在my.cnf中添加,可以用\,避免转义带来的问题 [root@192168066012_MySQL_5_7_27 ~]# vim /etc/my.cnf [mysql] prompt=\\u@\\h [\d] \\r:\\m:\\s-> 2 在mysql里使用help 默认情况下,MySQL中的命令是不区分大小写的; help <command> #可以查看具体命令的使用方法 root@localhost [(none)] 09:27:28->help show; Name: 'SHOW' Description: SHOW has many forms that provide information about databases, tables, columns,

mysql的用户权限设置

邮差的信 提交于 2019-11-26 12:18:47
一、首先我们需要来看一下mysql默认数据库里面的四张表(user,db,tables_priv,columns_priv)。 1、user表(用户层权限) 因为字段太多,只截取了一部分。首先登陆的时候验证Host,User,Password也就是ip,用户名,密码是否匹配,匹配登陆成功将会为登陆者分配权限,分配权限的顺序也是按照上面四张表的排列顺序进行的,举个例子,如果user表的Select_priv为Y说明他拥有所有表的查找权限,如果为N就需要到下一级db表中进行权限分配了。其中的%是通配符,代表任意的意思。 2、db表(数据库层权限) 来到db表之后会匹配Host,User然后会根据Db字段对应的表进行权限分配,像Select_priv这些字段对应的权限大家应该都能看出来是对应着什么权限了吧,这里不细说了(不偷懒,举个例子Select_priv,Insert_priv,Update_priv,Delete_priv,Create_priv,Drop_priv分别代表着查询,增加,更新,删除,创建,销毁)。其中Y代表这拥有此项权限,N则代表没有此项权限。 3、tables_priv表(表层权限) 与上面一样,这是通过Host,Db,User,Table来进行定位到表层的一个权限分配。不过它只有Table_priv和Column_priv两个字段来记录权限。 4、columns