Theo mặc định, MySQL được cấu hình để chỉ cho phép các kết nối từ hệ thống cục bộ. Nếu bạn muốn kết nối với máy chủ MySQL từ một hệ thống từ xa, bạn nên bảo mật nó bằng SSL/TLS. Kích hoạt SSL/TLS sẽ mã hóa dữ liệu được gửi đến và từ cơ sở dữ liệu
một năm trước • 6 phút đọc
Bởi Hitesh Jethva
Mục lục
Hướng dẫn này sẽ chỉ cho bạn cách bảo mật các kết nối MySQL bằng SSL/TLS trên Ubuntu 20. 04
điều kiện tiên quyết
• Một máy chủ chạy Ubuntu 20. 04
• Mật khẩu gốc được thiết lập trên máy chủ của bạn
Cài đặt máy chủ MySQL 8
Theo mặc định, máy chủ MySQL phiên bản 8 được bao gồm trong Ubuntu 20. 04 kho lưu trữ mặc định. Chạy lệnh sau để cài đặt nó
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y2
Sau khi cài đặt, hãy xác minh phiên bản MySQL đã cài đặt bằng lệnh bên dưới
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y3
đầu ra mẫu
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y4
Tiếp theo, khởi động dịch vụ MySQL và cho phép nó khởi động khi khởi động lại hệ thống
systemctl start mysql systemctl enable mysqlĐặt mật khẩu gốc MySQL
Theo mặc định, mật khẩu root của MySQL không được đặt. Vì vậy, nên đặt mật khẩu root MySQL vì lý do bảo mật
Chạy lệnh sau để đặt mật khẩu root MySQL
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y5
Bạn sẽ được hỏi một số câu hỏi như hình dưới đây
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : YTại thời điểm này, MySQL được bảo mật và mật khẩu gốc được đặt. Bây giờ bạn có thể tiến hành bước tiếp theo
Kiểm tra trạng thái SSL/TLS của MySQL
Trước tiên, bạn sẽ cần xác minh xem SSL/TLS có được bật trong MySQL hay không
Để làm như vậy, hãy đăng nhập vào MySQL bằng lệnh sau
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y6
Khi bạn đã đăng nhập, hãy chạy lệnh sau để kiểm tra trạng thái SSL/TLS
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y7
đầu ra mẫu
________số 8_______Như bạn có thể thấy, cả hai giá trị have_openssl và have_ssl đều bị vô hiệu hóa
Bạn cũng có thể xác minh trạng thái kết nối hiện tại bằng lệnh sau
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y8
đầu ra mẫu
-------------- mysql Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu)) Connection id: 10 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.25-0ubuntu0.20.04.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Binary data as: Hexadecimal Uptime: 1 min 49 sec Threads: 2 Questions: 15 Slow queries: 0 Opens: 147 Flush tables: 3 Open tables: 66 Queries per second avg: 0.137 --------------Như bạn có thể thấy, kết nối SSL không được sử dụng trong kết nối hiện tại
Bây giờ, thoát khỏi trình bao MySQL bằng lệnh sau
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y9
Tạo chứng chỉ SSL/TLS
Tiếp theo, bạn sẽ cần tạo chứng chỉ SSL/TLS và tệp khóa trong máy chủ của mình. Bạn có thể tạo chúng bằng tập lệnh mysql_ssl_rsa_setup
Bây giờ, hãy chạy tiện ích này như hình bên dưới để tạo khóa và chứng chỉ SSL/TLS
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)0
Thao tác này sẽ tạo và lưu tất cả các tệp chứng chỉ và khóa trong thư mục dữ liệu của MySQL tại/var/lib/mysql. Bạn có thể kiểm tra chúng bằng lệnh sau
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)1
Bạn sẽ thấy tất cả các tệp trong đầu ra sau
-rw------- 1 mysql mysql 1680 Jul 10 07:45 /var/lib/mysql/ca-key.pem -rw-r--r-- 1 mysql mysql 1112 Jul 10 07:45 /var/lib/mysql/ca.pem -rw-r--r-- 1 mysql mysql 1112 Jul 10 07:45 /var/lib/mysql/client-cert.pem -rw------- 1 mysql mysql 1680 Jul 10 07:45 /var/lib/mysql/client-key.pem -rw------- 1 mysql mysql 1680 Jul 10 07:45 /var/lib/mysql/private_key.pem -rw-r--r-- 1 mysql mysql 452 Jul 10 07:45 /var/lib/mysql/public_key.pem -rw-r--r-- 1 mysql mysql 1112 Jul 10 07:45 /var/lib/mysql/server-cert.pem -rw------- 1 mysql mysql 1680 Jul 10 07:45 /var/lib/mysql/server-key.pemBây giờ bạn có thể sử dụng các tệp đó để kích hoạt sử dụng SSL trên máy chủ MySQL của mình
Kích hoạt kết nối SSL trên MySQL
Để kích hoạt SSL/TLS trong MySQL. Khởi động lại dịch vụ MySQL bằng lệnh bên dưới
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)2
Bây giờ, hãy kết nối với trình bao MySQL và kiểm tra trạng thái bằng lệnh sau
mysql -u root -p --ssl-mode=required mysql> SHOW VARIABLES LIKE '%ssl%';Bạn sẽ thấy rằng cả hai biến have_openssl và have_ssl hiện đã được bật
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+Bạn cũng có thể kiểm tra trạng thái kết nối hiện tại bằng lệnh sau
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y8
đầu ra mẫu
-------------- mysql Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu)) Connection id: 8 Current database: Current user: root@localhost SSL: Cipher in use is TLS_AES_256_GCM_SHA384 Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.25-0ubuntu0.20.04.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Binary data as: Hexadecimal Uptime: 31 sec Threads: 2 Questions: 6 Slow queries: 0 Opens: 134 Flush tables: 3 Open tables: 53 Queries per second avg: 0.193 --------------Đầu ra ở trên chỉ ra rằng phiên MySQL hiện tại của bạn sử dụng kết nối SSL
Kích hoạt kết nối từ xa và an toàn trong MySQL
Theo mặc định, MySQL không cho phép đăng nhập từ máy chủ từ xa và cho phép kết nối không an toàn. Vì vậy, bạn sẽ cần định cấu hình MySQL để cho phép kết nối và chỉ chấp nhận các kết nối an toàn
Để làm như vậy, hãy chỉnh sửa tệp cấu hình chính của MySQL
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)4
Thêm/Sửa đổi các dòng sau
[mysqld] require_secure_transport = ON bind-address = 0.0.0.0Lưu và đóng tệp, sau đó khởi động lại dịch vụ MySQL để áp dụng các thay đổi cấu hình
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)2
Tiếp theo, tạo cơ sở dữ liệu và người dùng MySQL mới cho các máy khách MySQL từ xa
mysql -u root -p mysql> CREATE DATABASE remotedb; mysql> CREATE USER 'remoteuser'@'mysql-client-ip' IDENTIFIED BY 'yourpassword' REQUIRE SSL;Tiếp theo, cấp tất cả các đặc quyền cho remotedb bằng lệnh sau
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)6
Tiếp theo, xóa các đặc quyền và thoát khỏi MySQL bằng lệnh sau
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y0Xác minh kết nối SSL từ máy khách MySQL từ xa
Tại thời điểm này, máy chủ MySQL được cấu hình để chỉ chấp nhận các kết nối an toàn từ máy chủ từ xa. Bây giờ, đã đến lúc thử nghiệm nó
Đầu tiên, đăng nhập vào máy khách và kết nối máy chủ MySQL của bạn bằng lệnh sau
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)7
Khi bạn đã kết nối, hãy xác minh trạng thái SSL bằng lệnh sau
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y8
Bạn sẽ thấy đầu ra sau
Press y|Y for Yes, any other key for No: Y Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0 New password: Re-enter new password: Estimated strength of the password: 50 Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : Y Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y1Đầu ra ở trên chỉ ra rằng phiên MySQL hiện tại của bạn sử dụng kết nối SSL
Để xác nhận rằng máy chủ MySQL chỉ chấp nhận kết nối an toàn và từ chối kết nối không an toàn, hãy thử kết nối với máy chủ MySQL từ xa bằng chuỗi ---ssl-mode=disabled
+-------------------------------------+-----------------+ | Variable_name | Value | +-------------------------------------+-----------------+ | admin_ssl_ca | | | admin_ssl_capath | | | admin_ssl_cert | | | admin_ssl_cipher | | | admin_ssl_crl | | | admin_ssl_crlpath | | | admin_ssl_key | | | have_openssl | YES | | have_ssl | YES | | mysqlx_ssl_ca | | | mysqlx_ssl_capath | | | mysqlx_ssl_cert | | | mysqlx_ssl_cipher | | | mysqlx_ssl_crl | | | mysqlx_ssl_crlpath | | | mysqlx_ssl_key | | | performance_schema_show_processlist | OFF | | 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 | +-------------------------------------+-----------------+ 25 rows in set (0.01 sec)9
Bạn sẽ thấy lỗi sau
-------------- mysql Ver 8.0.25-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu)) Connection id: 10 Current database: Current user: root@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 8.0.25-0ubuntu0.20.04.1 (Ubuntu) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: utf8mb4 Db characterset: utf8mb4 Client characterset: utf8mb4 Conn. characterset: utf8mb4 UNIX socket: /var/run/mysqld/mysqld.sock Binary data as: Hexadecimal Uptime: 1 min 49 sec Threads: 2 Questions: 15 Slow queries: 0 Opens: 147 Flush tables: 3 Open tables: 66 Queries per second avg: 0.137 -------------- 0
Điều đó có nghĩa là máy chủ MySQL của bạn chỉ chấp nhận kết nối an toàn
Phần kết luận
Xin chúc mừng. Bạn đã bảo mật thành công MySQL bằng kết nối SSL/TLS trên Ubuntu 20. 04 máy chủ. Bây giờ, bất cứ khi nào bạn kết nối với máy chủ MySQL, dữ liệu của bạn sẽ được mã hóa