天天看點

MySQL主從ssl加密傳輸簽署證書報錯解決

案例:今天實施MySQL主從+SSL加密傳輸時候,master為slave簽署證書有一個小小問題:

failedto update database TXT_DBerror number 2

[root@mysql-masterssl]# openssl ca -in /tmp/slave.csr -out /tmp/slave.crt -days 3650      
MySQL主從ssl加密傳輸簽署證書報錯解決

一開始沒留意,最後導緻在slave通過證書連接配接master時候報錯證書錯誤。仔細檢查才看到錯誤。

1、報錯原因:

This thing happens when certificates share common data. You cannot have two 

certificates that look otherwise the same. 

意思當證書共享資料,不能兩個相同。

2、解決方式:

2.1)修改index.txt.attr為no(采用)

[root@mysql-master CA]# cat index.txt.attr
unique_subject = no
[root@mysql-master CA]#      

2.2)将comonName設定為不同

  在master和slave中,因為我用的名字都是renzhiyuan,才造成了這個問題。

3、slave重新登陸:(解決)

mysql-urepuser -pxxx -h192.168.1.220 --ssl-ca=/etc/mysql/ssl/cacert.pem--ssl-cert=/etc/mysql/ssl/slave.crt --ssl-key=/etc/mysql/ssl/slave.key