当前位置:  数据库>mysql

mysql通过ssl的方式生成秘钥具体生成步骤

    来源: 互联网  发布时间:2014-10-09

    本文导语:  -- mysql ssl 生成秘钥 1 check ssl是否已经开启 mysql> show variables like '%ssl%'; +---------------+----------+ | Variable_name | Value | +---------------+----------+ | have_openssl | DISABLED | | have_ssl | DISABLED | | ssl_ca | | | ssl_capath | | | ssl_cert | | | ssl_cipher | | | ssl_c...

-- mysql ssl 生成秘钥
1 check ssl是否已经开启
mysql> show variables like '%ssl%';
+---------------+----------+
| Variable_name | Value |
+---------------+----------+
| have_openssl | DISABLED |
| have_ssl | DISABLED |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | |
+---------------+----------+
9 rows in set (0.00 sec)

2 没有开启,所以打开
在my.cnf末尾端设置ssl 参数, 然后重新启动mysql服务即可
mysql> show variables like '%ssl%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_openssl | YES |
| have_ssl | YES |
| ssl_ca | |
| ssl_capath | |
| ssl_cert | |
| ssl_cipher | |
| ssl_crl | |
| ssl_crlpath | |
| ssl_key | |
+---------------+-------+
9 rows in set (0.00 sec)

3 通过openssl生成证书的配置, 在mysql db server上生成秘钥
mkdir -p /etc/mysql/newcerts/
cd /etc/mysql/newcerts/
3.1 openssl genrsa 2048 > ca-key.pem
3.2 openssl req -new -x509 -nodes -days 1000 -key ca-key.pem > ca-cert.pem
[root@mysql newcerts]# openssl req -new -x509 -nodes -days 1000 -key ca-key.pem > ca-cert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:ch
State or Province Name (full name) []:shh
Locality Name (eg, city) [Default City]:shh
Organization Name (eg, company) [Default Company Ltd]:xx
Organizational Unit Name (eg, section) []:db
Common Name (eg, your name or your server''s hostname) []:mysql.yest.nos
Email Address []:xx@xx.com
3.3 openssl req -newkey rsa:2048 -days 1000 -nodes -keyout server-key.pem > server-req.pem
[root@mysql newcerts]# openssl req -newkey rsa:2048 -days 1000 -nodes -keyout server-key.pem > server-req.pem
Generating a 2048 bit RSA private key
.......................................................................................................+++
..........................................................+++
writing new private key to 'server-key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:ch
State or Province Name (full name) []:shh
Locality Name (eg, city) [Default City]:ssh
Organization Name (eg, company) [Default Company Ltd]:xx
Organizational Unit Name (eg, section) []:db
Common Name (eg, your name or your server''s hostname) []:mysql.yest.nos
Email Address []:xx@xx.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:820923
An optional company name []:xx

4 在mysql db server客户端生成ssl文件
4.1 openssl x509 -req -in server-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem
[root@mysql newcerts]# openssl x509 -req -in server-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > server-cert.pem
Signature ok
subject=/C=ch/ST=shh/L=ssh/O=ea/OU=db/CN=mysql.yest.nos/emailAddress=cm@xx.com
Getting CA Private Key
4.2 openssl req -newkey rsa:2048 -days 1000 -nodes -keyout client-key.pem > client-req.pem
[root@mysql newcerts]# openssl req -newkey rsa:2048 -days 1000 -nodes -keyout client-key.pem > client-req.pem
Generating a 2048 bit RSA private key
.......+++
........................................................+++
writing new private key to 'client-key.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [XX]:ch
State or Province Name (full name) []:shh
Locality Name (eg, city) [Default City]:shh
Organization Name (eg, company) [Default Company Ltd]:xx
Organizational Unit Name (eg, section) []:db
Common Name (eg, your name or your server''s hostname) []:mysql.yest.nos
Email Address []:cx@xx.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:820923
An optional company name []:xx
4.3
openssl x509 -req -in client-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > client-cert.pem
[root@mysql newcerts]# openssl x509 -req -in client-req.pem -days 1000 -CA ca-cert.pem -CAkey ca-key.pem -set_serial 01 > client-cert.pem
Signature ok
subject=/C=ch/ST=shh/L=shh/O=ea/OU=db/CN=mysql.yest.nos/emailAddress=cm@xx.com
Getting CA Private Key

5
[]copy clent.* 3个文件到客户端机器上面/opt/mysql/ssl/去。

6 登陆验证
mysql -uxxx -pxxxx --ssl-ca=/opt/mysql/ssl/ca-cert.pem --ssl-cert=/opt/mysql/ssl/server-cert.pem --ssl-key=/opt/mysql/ssl/server-key.pem
conferce:http://www.docin.com/p-151590189.html

    
 
 

您可能感兴趣的文章:

  • MySQL文档生成工具 mysqldgtool
  • MySQL中随机生成固定长度字符串的方法
  • MySQL与MSSQl使用While语句循环生成测试数据的代码
  • ms sql server中实现的unix时间戳函数(含生成和格式化,可以和mysql兼容)
  • mysql 动态生成测试数据
  • MySQL 随机密码生成代码
  • MySQL rownumber SQL生成自增长序号使用介绍
  • php将mysql数据库整库导出生成sql文件的具体实现
  • sqlserver数据库主键的生成方式小结(sqlserver,mysql)
  • mysql jdbc连接mysql数据库步骤及常见参数详解
  • 如何用命令行进入mysql具体操作步骤
  • sqlserver、mysql获取连接字符串步骤
  • 更改Mysql数据库存储位置的具体步骤
  • MySQL 的 JDBC 下载地址,安装步骤,以及Java的调用方法
  • MYSQL ZIP免安装版配置步骤及图形化管理工具mysql-workbench
  • 修改mysql5.5默认编码(图文步骤修改为utf-8编码)
  • 有谁能具体讲一下安装mysql的步骤吗?(100分相送)
  • MySQL数据库迁移data文件夹位置详细步骤
  • java连接mysql数据库详细步骤解析
  • centos下mysql主从同步快速设置步骤分享
  • 紧急求助:我是哪个步骤错了?MySql老是启动不了!
  • 两大步骤教您开启MySQL 数据库远程登陆帐号的方法
  • win2003 mysql单向同步配置步骤[已测]
  • Windows服务器下MySql数据库单向主从备份详细实现步骤分享
  • Java连接MYSQL数据库的实现步骤
  • 通过HSODBC访问mysql的实现步骤
  • mysql同步复制搭建方法指南详细步骤
  • Apache+PHP3+MySQL的安装问题,我按以下步骤操作,怎么不成功/?
  • MySQL 优化设置步骤
  • mysql免安装版配置步骤详解分享
  •  
    本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
    本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • LAMP环境下,通过非root用户,可以获取mysql的用户名和密码吗?
  • php开源软件 iis7站长之家
  • 怎么样才能使jsp和mysql通过jdbc连接上?
  • mysql通过查看跟踪日志跟踪执行的sql语句
  • mysql查询语句通过limit来限制查询的行数
  • mysql主从连接失败,怎样通过binlog日志恢复呢?
  • jsp通过jdbc与mysql链接权限问题????
  • 通过dbi使用perl连接mysql数据库的方法
  • 通过mysql-proxy完成mysql读写分离
  • 通过命令行导入到mysql数据库时出现乱码的解决方法
  • 通过java备份恢复mysql数据库的实现代码
  • 通过mysql show processlist 命令检查mysql锁的方法
  • MyEclipse通过JDBC连接MySQL数据库基本介绍
  • Oracle10g通过DBLink访问MySQL示例
  • MySQL 通过索引优化含ORDER BY的语句
  • 通过mysqladmin远程管理mysql的方法
  • mysql中如何查看最大连接数(max_connections)和修改最大连接数
  • 在 linux下输入"mysql"命令,进入mysql命令行,但出现“Can't connetc to local MySQL server thuough socket /var/lib/mysql/mysql.sock
  • Mysql查询错误:ERROR:no query specified原因
  • MySQL 重装MySQL后, mysql服务无法启动
  • php安装完成后如何添加mysql扩展
  • 为什么用linux安装盘安装了mysql后,启动mysql,提示找不到mysql.sock文件?
  • mysql中查询当前正在运行的SQL语句并找出mysql中运行慢的sql语句
  • 請教,在redhat linux7.2+mysql 中,系統提示mysql已啟動,網頁卻不能訪問mysql?
  • Myeclipse中自带Tomcat的JDBC连接池配置(mysql和mssql)
  • 求解释: useradd -g mysql mysql -d /home/mysql -s /sbin/nologin
  • MySQL Workbench的下载安装与使用教程
  • 在Linux内安装了Mysql,无法进入Mysql.
  • php中内置的mysql数据库连接驱动mysqlnd简介及mysqlnd的配置安装方式
  • 怎样在linux终端输入mysql直接进入mysql?
  • VS2012+MySQL+SilverLight5的MVVM开发模式介绍


  • 站内导航:


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

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

    浙ICP备11055608号-3