grant

creating user in mysql using java

故事扮演 提交于 2019-12-02 16:59:02
问题 In MySQL command line client after logging in as root, I typed: connect mydb; grant all privileges on mydb.* to 'admin'@'localhost' identified by 'pass'; Now within Java , I succesfully connect to the db using the admin userid using drivers. Statement put=connect.createStatement(); //**WORKS succesfully** put.execute("insert into mydb.emp values(100,joe)"); //**does NOT work** put.execute("grant all privileges on mydb.* to 'john'@'localhost' identified by 'pass'"); Why does an insert command

MySQL创建用户与授权

亡梦爱人 提交于 2019-12-02 16:49:19
MySQL创建用户与授权 一. 创建用户 命令: CREATE USER 'username'@'host' IDENTIFIED BY 'password'; 说明: username:你将创建的用户名 host:指定该用户在哪个主机上可以登陆,如果是本地用户可用localhost,如果想让该用户可以 从任意远程主机登陆 ,可以使用通配符 % password:该用户的登陆密码,密码可以为空,如果为空则该用户可以不需要密码登陆服务器 例子: CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456'; CREATE USER 'pig'@'192.168.1.101_' IDENDIFIED BY '123456'; CREATE USER 'pig'@'%' IDENTIFIED BY '123456'; CREATE USER 'pig'@'%' IDENTIFIED BY ''; CREATE USER 'pig'@'%'; 二. 授权: 命令: GRANT privileges ON databasename.tablename TO 'username'@'host' 说明: privileges:用户的操作权限,如 SELECT , INSERT , UPDATE 等,如果要授予所的权限则使用 ALL

oracle中新建用户和赋予权限

一笑奈何 提交于 2019-12-02 15:48:06
1.新建个用户 create user xxxxx(用户名) identified by "密码" alert user 用户名 identified by “新密码” --修改用户密码 因为新建的用户和默认的用户是锁住的,没有权限。所以新建用户后要给用户赋予权限 grant dba to 用户名 --给用户赋予所有权限,connect是赋予连接数据库的权限,resource 是赋予用户只可以创建实体但是没有创建数据结构的权限。 grant create session to 用户名    --这个是给用户赋予登录的权限。 grant create table to 用户名    --给用户赋予表操作的权限 grant unlimited tablespace to 用户名 --给用户赋予表空间操作的权限 grant select any table to 用户名 --给该用户赋予访问任务表的权限 同理可以赋予update 和delete 的 grant select on srapp_hz_zhpt_yl.jggl to srapp_hz_zhpt_ylcs --这里是给srapp_hz_zhpt_ylcs用户赋予selectsrapp_hz_zhpt_yl用户的jggl表的查询的权限。同理可以有alter,drop,insert等权限。 --------------------

MySQL授权命令grant的使用方法

你。 提交于 2019-12-02 14:47:18
1 本文实例,运行于 MySQL 5.0 及以上版本。 2 3 MySQL 赋予用户权限命令的简单格式可概括为: 4 grant 权限 on 数据库对象 to 用户 5 6 7 8 一、grant 普通数据用户,查询、插入、更新、删除 数据库中所有表数据的权利。 9 grant select on testdb.* to common_user@'%' 10 grant insert on testdb.* to common_user@'%' 11 grant update on testdb.* to common_user@'%' 12 grant delete on testdb.* to common_user@'%' 13 14 或者,用一条 MySQL 命令来替代: 15 grant select, insert, update, delete on testdb.* to common_user@'%' 16 17 18 19 二、grant 数据库开发人员,创建表、索引、视图、存储过程、函数。。。等权限。 20 21 grant 创建、修改、删除 MySQL 数据表结构权限。 22 grant create on testdb.* to developer@'192.168.0.%'; 23 grant alter on testdb.* to developer

creating user in mysql using java

喜你入骨 提交于 2019-12-02 11:35:12
In MySQL command line client after logging in as root, I typed: connect mydb; grant all privileges on mydb.* to 'admin'@'localhost' identified by 'pass'; Now within Java , I succesfully connect to the db using the admin userid using drivers. Statement put=connect.createStatement(); //**WORKS succesfully** put.execute("insert into mydb.emp values(100,joe)"); //**does NOT work** put.execute("grant all privileges on mydb.* to 'john'@'localhost' identified by 'pass'"); Why does an insert command work but grant command never work through Java? Please help. put.execute(MySQL query) in here you can

How can i see if an owner has permissions to execute a Store Procedure in Oracle

こ雲淡風輕ζ 提交于 2019-12-02 08:39:17
I need to validate if my owner has permissions to execute a store procedure, but i have to do it searching on a sys table. In which table i can find it. Thank you!! Sandeep Contrary to its name, DBA_TAB_PRIVS allows us to see granted privileges on all objects, not just table. select * from DBA_TAB_PRIVS where type='PROCEDURE' and privilege='EXECUTE' and OWNER='SCHEMANAME' AND TABLE_NAME='PROCEDURENAME'; 来源: https://stackoverflow.com/questions/35776327/how-can-i-see-if-an-owner-has-permissions-to-execute-a-store-procedure-in-oracle

mysql8.0.13安装、使用教程图解

大城市里の小女人 提交于 2019-12-02 06:51:33
mysql8.0.13安装、使用教程图解 MySQL是最流行的关系型数据库管理系统之一,在 WEB 应用方面,MySQL是最好的 RDBMS (Relational Database Management System,关系数据库管理系统) 应用软件。 下面给大家介绍 mysql8.0.18安装图解教程 (解压版) 步骤一 :先到官网下载MySQL https://dev.mysql.com/downloads/mysql/ 步骤二 :解压到自己要安装的文件夹或磁盘里,解压后的所有文件: 步骤三 :安装版的会有一个my.ini文件,解压版的没有,所以我们需要自己在根目录下新建一个,写入基础设置 my.ini : [mysqld] # 设置3306端口 port=3306 # 设置mysql的安装目录,这里根据自己的解压目录来写 basedir=E:\mysql-8.0.13-winx64 # 设置mysql数据库的数据的存放目录,解压后的文件里有个Data文件夹 datadir=E:\mysql-8.0.13-winx64\Data # 允许最大连接数 max_connections=200 # 允许连接失败的次数。 max_connect_errors=10 # 服务端使用的字符集默认为UTF8 character-set-server=utf8mb4 #

Oracle数据库导库常见问题及处理

蓝咒 提交于 2019-12-02 01:54:48
1、登录管理员权限用户,新建用户 create user hy          --新建用户hy identified by hy        --密码 default tablespace bjkname;  --分配表空间为tsn 2、给用户授权 --grant 角色 | 权限 to yh grant connect to yh; --赋予连接登录的权限 grant dba to yh; --最高权限dba grant resource to yh; --通常给开发人员授权resource 3、登录用户,导库 cmd导表命令: imp 用户名/密码@实例名 file=dmp文件路径 log=要导出的日志路径 full=y; 4、更新同义词 select 'create or replace synonym '||synonym_name ||' for xxx.'||synonym_name||';' from user_synonyms --xxx为新的对象拥有者 5、存储过程报错:授权 全部重新编译 若报错 同义词转换不再有效 :     授权: grant select,insert,delete,update on xxxtable to yh; --xxxtable为报错的表名 再重新编译 来源: https://www.cnblogs.com/csyzlm/p

MySQL基础:DCL语句总结

牧云@^-^@ 提交于 2019-12-02 00:11:21
SQL语言大致分为 DCL 、 DDL 、 DML 三种,本文主要介绍 MySQL 5.7 版本 DCL 语句。 概述 DCL (Data Control Language)语句:数据控制语句,用于控制不同数据段直接的许可和访问级别的语句。这些语句定义了数据库、表、字段、用户的访问权限和安全级别。 关键字 GRANT REVOKE 查看用户权限 当成功创建用户账户后,还不能执行任何操作,需要为该用户分配适当的访问权限。可以使用 SHOW GRANTS FOR 语句来查询用户的权限。例如: mysql> SHOW GRANTS FOR test; +-------------------------------------------+ | Grants for test@% | +-------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'test'@'%' | +-------------------------------------------+ 1 row in set (0.00 sec) GRANT语句 参考: GRANT Syntax MySQL用户授权(GRANT) 对于新建的MySQL用户,必须给它授权,可以用 GRANT 语句来实现对新建用户的授权。 语法格式

mysql基础之mariadb的安装,连接,用户,密码,权限设置语句详解

时光毁灭记忆、已成空白 提交于 2019-12-01 23:07:16
一、 mariadb 安装 1、配置mariadb源: [root@bi7 ~]# vim /etc/yum.repos.d/mariadb.repo [mariadb] name = MariaDB baseurl = http://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64/ gpgkey=http://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=1 2、yum安装(下载时该大写的必须大写): [root@bi7 ~]# yum -y install MariaDB 3、安装完成后需要重启mariadb: [root@bi7 ~]# systemctl restart mariadb 4、初始化数据库( 安全配置向导 ): [root@bi7 ~]# mysql_secure_installation 运行mysql_secure_installation会执行几个设置: --为root用户设置密码 --删除匿名账号 --取消root用户远程登录 --删除test库和对test库的访问权限 --刷新授权表使修改生效 5 、客户端程序: mysql---交互式的client工具 mysqldump---备份工具