当前位置:  数据库>oracle

关于Oracle和MySQL中的无密码登录

    来源: 互联网  发布时间:2017-06-16

    本文导语: 无密码登录在一定程度上能够简化流程,对于密码敏感,但是又需要提供访问权限的情况下是一个不错的选择。尤其是在乙方在做一些操作的时候,要密码和给密码是一个纠结的问题。不给没法工作,给了又对信息安全又影响。...

无密码登录在一定程度上能够简化流程,对于密码敏感,但是又需要提供访问权限的情况下是一个不错的选择。尤其是在乙方在做一些操作的时候,要密码和给密码是一个纠结的问题。不给没法工作,给了又对信息安全又影响。

在Oracle和MySQL中都有相应的解决方案,大道至简,这个功能的目的都是类似的。

在Oracle中可以通过设置wallet来实现,在10g版本开始支持。而在MySQL中自5.6版本开始可以使用--login-path来实现。

先来看看Oracle中的wallet实现无密码登录,可以通过mkstore来配置,我们可以使用--help得到命令使用的帮助。

[ora11g@oel1 admin]$ mkstore --help
 Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
 Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
 No wallet location specified.
 mkstore [-wrl wrl] [-create] [-createSSO] [-createLSSO] [-createALO] [-delete] [-deleteSSO] [-list] [-createEntry alias secret] [-viewEntry alias] [-modifyEntry alias secret] [-deleteEntry alias] [-createCredential connect_string username password] [-listCredential] [-modifyCredential connect_string username password] [-deleteCredential connect_string] [-help] [-nologo]
我们首先来创建钱包,指定钱包路径为/u02/ora11g/wallet,对于密码还是有一定的要求,太简单也不行。
$ mkstore -wrl /u02/ora11g/wallet -create
 Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
 Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
 Enter password:         
 Enter password again: 
生成钱包后,会在指定的路径下生成两个文件。
$ ll
 total 8
 -rw------- 1 ora11g dba 3589 May 17 21:37 cwallet.sso
 -rw------- 1 ora11g dba 3512 May 17 21:37 ewallet.p12
我们可以指定临时的连接串来配置到钱包里面,比如我们认为test11g是一个临时连接串,可以使用tnsping来测试,确保连接串是可访问的。
$tnsping test11g
 Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = oel1.oracle.com)(PORT = 1511))) (CONNECT_DATA = (SERVICE_NAME = TEST11G)))
 OK (0 msec)
配置完成之后,我们需要在登录之前在sqlnet.ora中配置钱包的路径。sqlnet.ora中需要配置的内容如下:
$ cat sqlnet.ora
 WALLET_LOCATION =
  (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
      (DIRECTORY = /u02/ora11g/wallet)
    )
  )

SQLNET.WALLET_OVERRIDE=true
这些配置都搞定以后我们就可以指定对应的连接串,对应的用户名密码。
$ mkstore -wrl /u02/ora11g/wallet -createCredential test11g n1 n1
 Oracle Secret Store Tool : Version 11.2.0.1.0 - Production
 Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
 Enter wallet password:  l      1
Create credential oracle.security.client.connect_string1
配置完成之后工作就完成了,我们可以简单验证一下。
$ sqlplus /@test11g
 SQL*Plus: Release 11.2.0.1.0 Production on Sun May 17 21:45:59 2015
 With the Partitioning, OLAP, Data Mining and Real Application Testing options
 n1@TEST11G>

而如果使用MySQL来实现,则需要通过mysql_config_editor来配置。
mysql_config_editor的命令提示如下,可以看出可使用的选项还是相对比较简单的。
[mysql@oel1 ~]$ mysql_config_editor set --help
 mysql_config_editor Ver 1.0 Distrib 5.6.23, for linux-glibc2.5 on i686
 Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 Oracle is a registered trademark of Oracle Corporation and/or its
 affiliates. Other names may be trademarks of their respective
 owners.

 MySQL Configuration Utility.
 Description: Write a login path to the login file.
 Usage: mysql_config_editor [program options] [set [command options]]
  -?, --help          Display this help and exit.
  -h, --host=name    Host name to be entered into the login file.
  -G, --login-path=name
                      Name of the login path to use in the login file. (Default
                      : client)
  -p, --password      Prompt for password to be entered into the login file.
  -u, --user=name    User name to be entered into the login file.
  -S, --socket=name  Socket path to be entered into login file.
  -P, --port=name    Port number to be entered into login file.
  -w, --warn          Warn and ask for confirmation if set command attempts to
                      overwrite an existing login path (enabled by default).
                      (Defaults to on; use --skip-warn to disable.)
我们直接可以通过一个命令来完成配置,制定这个无密码登录的别名为fastlogin

[mysql@oel1 ~]$ mysql_config_editor set --login-path=fastlogin --user=root --host=localhost --password --socket=/u02/mysql/mysqld_mst.sock
 Enter password:
配置完成之后,会在当前路径下生成一个隐藏文件.mylogin.cnf
 [mysql@oel1 ~]$ ll -la .mylogin*
 -rw------- 1 mysql dba 480 May 17 22:10 .mylogin.cnf
 [mysql@oel1 ~]$
大功告成,这个时候直接登录即可。
[mysql@oel1 ~]$ mysql --login-path=fastlogin
 Welcome to the MySQL monitor.  Commands end with ; or g.
 Your MySQL connection id is 3
 Server version: 5.6.23-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)
 Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

 Oracle is a registered trademark of Oracle Corporation and/or its
 affiliates. Other names may be trademarks of their respective
 owners.
 Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
 mysql>


    
 
 

您可能感兴趣的文章:

  • Linux平台下Oracle 密码文件重建
  • ORACLE 中修改用户密码的方法
  • 安装Oracle 10g忘记sys密码
  • 登录oracle数据库时密码忘记的解决方法
  • Oracle 忘记密码的找回方法
  • Linux下修改Oracle用户密码
  • 修改Oracle默认用户密码有效期时间
  • Oracle密码文件的使用和维护第1/3页
  • oracle修改scott密码与解锁的方法详解
  • oracle 重置sys密码的方法介绍
  • Oracle 11G密码180天过期后的修改方法
  • 将oracle用户密码设置成只有数字的
  • Oracle用户密码含特殊字符时登陆失败问题
  • Oracle数据库密码文件的使用与维护
  • oracle忘记sys/system/scott用户密码的解决方法
  • oracle中不知道某数据库用户密码的情况下也能登陆
  • Oracle 密码丢失解决方法祥述
  • 怎样拒绝Oracle数据库的密码出现@符号
  • Oracle数据库密码出现@符号的解决
  • Oracle用户密码含有特殊字符导致无法登陆解决方法
  • Oracle 10g各个帐号的访问权限、登录路径、监控状态命令查询等等
  • 学习登录oracle数据库时常用的操作命令
  • asp.net使用ODP即oracle连接方式的的防注入登录验证程序
  • Oracle限制IP登录
  • Oracle 10g的DBA无法登录解决方案
  • [Oracle] 如何使用触发器实现IP限制用户登录
  • Linux下安装Metasploit破解Oracle登录用户名密码
  • Oracle 登录产生了01033错误
  •  
    本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
    本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • Oracle欲收购开源数据库MySQL未果
  • MySQL类似Oracle的dual虚拟表
  • 在linux下是MYSQL好还是ORACLE厉害?
  • Oracle与Mysql主键、索引及分页的区别小结
  • MySQL实现类似Oracle中的decode()函数的功能
  • Linux(redhat)下除了oracle / MySql 外还有哪些稍大型一点的 数据库
  • mysql仿oracle的decode效果查询
  • MySQL 移植到Oracle10 的问题
  • Oracle承诺一出 MySQL 5.5 版就发布
  • 解析mysql与Oracle update的区别
  • oracle与mysql的视频教程下载地址分享
  • 调查服务器系统BSD,SCO,Linux,windows?和数据库mysql,oracle,sqlserver?
  • 取数据库前几条数据(sql server、oracle、mysql)的sql写法
  • Oracle和MySQL对比
  • 调查显示MySQL进一步蚕食Oracle市场
  • 关于MySQL和Oracle转化的问题及解决
  • MySQL数据迁移到Oracle记录
  • Oracle并购SUN应放松对MySQL控制
  • JSP连接MySql/MS SQL Server/Oracle数据库连接方法[整理]
  • Oracle与Mysql自动增长列(id)的区别
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • oracle 11g最新版官方下载地址
  • 请问su oracle 和su - oracle有什么不同?
  • Oracle 数据库(oracle Database)Select 多表关联查询方式
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3