校园春色亚洲色图_亚洲视频分类_中文字幕精品一区二区精品_麻豆一区区三区四区产品精品蜜桃

主頁 > 知識庫 > mysql配置SSL證書登錄的實現

mysql配置SSL證書登錄的實現

熱門標簽:電話機器人接口是什么樣的 溫州語音外呼系統排名 AI智能云呼電話機器人怎么注冊 福州外呼系統招商 百度地圖標注信息怎么修改 四川穩定外呼系統公司 怎么在高德地圖標注多個點 商家地圖標注圖片 沈陽外呼系統有效果嗎

前言

國家等級保護三級安全要求,mysql 的 ssl 需要安全證書加密,這里需要研究一下,選幾個賬戶演示下即可。mysql 的版本為 8.0.20

一、Mysql 啟用 SSL 配置

1.1 檢查是否開啟 ssl

mysql> show variables like '%ssl%';
+--------------------+-----------------+
| Variable_name      | Value           |
+--------------------+-----------------+
| have_openssl       | YES             |  
| have_ssl           | YES             |  # 已開啟ssl
| mysqlx_ssl_ca      |                 |
| mysqlx_ssl_capath  |                 |
| mysqlx_ssl_cert    |                 |
| mysqlx_ssl_cipher  |                 |
| mysqlx_ssl_crl     |                 |
| mysqlx_ssl_crlpath |                 |
| mysqlx_ssl_key     |                 |
| ssl_ca             | ca.pem          |
| ssl_capath         |                 |
| ssl_cert           | server-cert.pem |
| ssl_cipher         |                 |
| ssl_crl            |                 |
| ssl_crlpath        |                 |
| ssl_fips_mode      | OFF             |
| ssl_key            | server-key.pem  |
+--------------------+-----------------+
17 rows in set (0.56 sec)

1.2 設置用戶是否使用 SSL 連接

mysql> select ssl_type from user where user = 'dev_fqr' ;
+----------+
| ssl_type |
+----------+
|          |
+----------+
1 row in set (0.05 sec)

默認用戶是沒有使用 SSL 登錄的。
我們可以強制這個管理用戶使用 SSL 登錄。

alter user 'xxx'@'%' require ssl;
取消ssl驗證:
alter user 'xxx'@'%' require none;

更改后,該賬戶就無法登錄了,查看狀態變成下面這種

mysql> select ssl_type from user where user = 'dev_fqr' ;
+----------+
| ssl_type |
+----------+
| ANY      |
+----------+
1 row in set (0.01 sec)

測試登錄,本機無法直接登錄。

[root@localhost data]# mysql -u dev_fqr -p
Enter password: 
ERROR 2026 (HY000): SSL connection error: SSL is required but the server doesn't support it

遠程客戶端無法直接登錄:

1.3 使用 SSL 登錄

要想通過 SSL 登錄,就需要用到下面這幾個證書,通過 client 證書 與 server 端進行校驗通過才能登錄成功。

1) 本機登錄

在 data 目錄下的三個文件證書登錄。

[root@localhost data]# mysql -udev_fqr -pDev@fqr2021 --ssl-ca=ca.pem --ssl-cert=client-cert.pem --ssl-key=client-key.pem
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 55
Server version: 8.0.22 MySQL Community Server - GPL
​
Copyright (c) 2000, 2020, 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.
​
You are enforcing ssl connection via unix socket. Please consider
switching ssl off as it does not make connection via unix socket
any more secure.
mysql> 

2)navicate 遠程客戶端登錄

把這三個證書下載下來

配置證書目錄,即可遠程訪問:

二、總結

因為測評的時候不會看 JDBC 里面的配置,所以 JDBC 就不改了,不然要改動的地方非常的多,具體演示的時候可以用提前準備兩個賬號,到時候用客戶端連接即可。
目前兩臺 mysql 的ssl 用戶如下:

到此這篇關于mysql配置SSL證書登錄的實現的文章就介紹到這了,更多相關mysql SSL證書登錄內容請搜索腳本之家以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持腳本之家! 

您可能感興趣的文章:
  • 通過mysql show processlist 命令檢查mysql鎖的方法
  • MySQL 使用 SSL 連接配置詳解
  • MySQL SHOW PROCESSLIST協助故障診斷全過程
  • 多種不同的 MySQL 的 SSL 配置
  • MySQL基于SSL協議進行主從復制的詳細操作教程
  • 多種不同的 MySQL 的 SSL 配置
  • MySQL配置SSL主從復制

標簽:西寧 汕尾 營口 來賓 邯鄲 七臺河 寶雞 無錫

巨人網絡通訊聲明:本文標題《mysql配置SSL證書登錄的實現》,本文關鍵詞  mysql,配置,SSL,證書,登錄,;如發現本文內容存在版權問題,煩請提供相關信息告之我們,我們將及時溝通與處理。本站內容系統采集于網絡,涉及言論、版權與本站無關。
  • 相關文章
  • 下面列出與本文章《mysql配置SSL證書登錄的實現》相關的同類信息!
  • 本頁收集關于mysql配置SSL證書登錄的實現的相關信息資訊供網民參考!
  • 推薦文章
    主站蜘蛛池模板: 家居| 巴彦县| 万州区| 乐业县| 名山县| 阳东县| 西昌市| 呼和浩特市| 社旗县| 清涧县| 辽宁省| 政和县| 霍林郭勒市| 苗栗市| 宁强县| 泰来县| 蒙阴县| 四平市| 宣化县| 朝阳区| 洪雅县| 普陀区| 犍为县| 宝应县| 福泉市| 淳安县| 长白| 隆回县| 青海省| 武宁县| 泸定县| 利辛县| 潢川县| 杂多县| 桑日县| 临安市| 遵义市| 门头沟区| 京山县| 图片| 阿拉尔市|