mysql通過(guò)ssl的方式生成秘鑰具體生成步驟
1 check ssl是否已經(jīng)開(kāi)啟
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 沒(méi)有開(kāi)啟,所以打開(kāi)
在my.cnf末尾端設(shè)置ssl 參數(shù), 然后重新啟動(dòng)mysql服務(wù)即可
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 通過(guò)openssl生成證書(shū)的配置, 在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客戶(hù)端生成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個(gè)文件到客戶(hù)端機(jī)器上面/opt/mysql/ssl/去。
6 登陸驗(yàn)證
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
- linux系統(tǒng)中使用openssl實(shí)現(xiàn)mysql主從復(fù)制
- 多種不同的 MySQL 的 SSL 配置
- MySQL基于SSL協(xié)議進(jìn)行主從復(fù)制的詳細(xì)操作教程
- 多種不同的 MySQL 的 SSL 配置
- mysql show processlist 顯示mysql查詢(xún)進(jìn)程
- 通過(guò)mysql show processlist 命令檢查mysql鎖的方法
- processlist命令 查看mysql 線程
- Apache、SSL、MySQL和PHP平滑無(wú)縫地安裝
- apache+mysql+php+ssl服務(wù)器之完全安裝攻略
- MySQL 使用 SSL 連接配置詳解
相關(guān)文章
mysql滑動(dòng)聚合/年初至今聚合原理與用法實(shí)例分析
這篇文章主要介紹了mysql滑動(dòng)聚合原理與用法,結(jié)合實(shí)例形式分析了mysql滑動(dòng)聚合的相關(guān)功能、原理、使用方法及操作注意事項(xiàng),需要的朋友可以參考下2019-12-12MySQL單表千萬(wàn)級(jí)數(shù)據(jù)處理的思路分享
日前筆者需要處理MySQL單表千萬(wàn)級(jí)的電子元器件數(shù)據(jù),進(jìn)行數(shù)據(jù)歸類(lèi), 數(shù)據(jù)清洗以及器件參數(shù)處理,進(jìn)而得出國(guó)產(chǎn)器件與國(guó)外器件的替換兼容性數(shù)據(jù),為電子工程師尋找國(guó)產(chǎn)替換件提供參考。2021-06-06詳解MySQL數(shù)據(jù)庫(kù)--多表查詢(xún)--內(nèi)連接,外連接,子查詢(xún),相關(guān)子查詢(xún)
這篇文章主要介紹了MySQL多表查詢(xún),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04優(yōu)化MySQL數(shù)據(jù)庫(kù)中的查詢(xún)語(yǔ)句詳解
這篇文章主要介紹了優(yōu)化MySQL數(shù)據(jù)庫(kù)中的查詢(xún)語(yǔ)句,非常實(shí)用的經(jīng)驗(yàn)總結(jié),需要的朋友可以參考下2014-07-07MySQL控制流函數(shù)(-if?,elseif,else,case...when)
這篇文章主要介紹了MySQL控制流函數(shù)(-if?,elseif,else,case...when),文章圍繞主題展開(kāi)詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的朋友可以參考一下2022-07-07淺談MySQL 億級(jí)數(shù)據(jù)分頁(yè)的優(yōu)化
mysql大數(shù)據(jù)量使用limit分頁(yè),隨著頁(yè)碼的增大,查詢(xún)效率越低下。本文就來(lái)介紹一下MySQL 億級(jí)數(shù)據(jù)分頁(yè)的優(yōu)化,感興趣的小伙伴們可以參考一下2021-06-06Win10環(huán)境下安裝Mysql5.7.23問(wèn)題及遇到的坑
這篇文章主要介紹了Win10環(huán)境下安裝Mysql5.7.23問(wèn)題及遇到的坑,本文通過(guò)圖文并茂的形式給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-11-11