집 >데이터 베이스 >MySQL 튜토리얼 >MySQL配置SSL的实际操作流程
以下的文章主要介绍的是MySQL配置SSL的实际操作步骤,此文章主要是以其实际应用代码来引出MySQL配置SSL的实际操作流程,以下就是具体内容的描述,望在你今后的学习中会对你有所帮助。 [client] ssl-ca =$DIR/cacert.pem ssl-cert =$DIR/client-cert.pem ssl-
以下的文章主要介绍的是MySQL配置SSL的实际操作步骤,此文章主要是以其实际应用代码来引出MySQL配置SSL的实际操作流程,以下就是具体内容的描述,望在你今后的学习中会对你有所帮助。
<ol class="dp-xml"> <li class="alt"><span><span>[client] </span></span></li> <li> <span class="attribute">ssl-ca</span><span>=$DIR/cacert.pem </span> </li> <li class="alt"> <span class="attribute">ssl-cert</span><span>=$DIR/client-cert.pem </span> </li> <li> <span class="attribute">ssl-key</span><span>=$DIR/client-key.pem </span> </li> <li class="alt"> <span>[</span>MySQL<span>d] </span> </li> <li> <span class="attribute">ssl-ca</span><span>=$DIR/cacert.pem </span> </li> <li class="alt"> <span class="attribute">ssl-cert</span><span>=$DIR/server-cert.pem </span> </li> <li> <span class="attribute">ssl-key</span><span>=$DIR/server-key.pem </span> </li> </ol>
6. 测试启动MySQL
<ol class="dp-xml"> <li class="alt"><span><span>$DIR 是选项文件my.cnf 的路径 </span></span></li> <li> <span>shell</span><span class="tag">></span><span> </span>MySQL<span>d </span><span class="attribute">--defaults-file</span><span>=$DIR/my.cnf & </span> </li> <li class="alt"><span>Then invoke a client program using the same option file: </span></li> <li> <span>shell</span><span class="tag">></span><span> </span>MySQL<span> </span><span class="attribute">--defaults-file</span><span>=$DIR/my.cnf </span> </li> <li class="alt"> <span>[root@localhost </span>MySQL<span>-5.0.20a]# chown -R root /usr/local/</span>MySQL<span> </span> </li> <li> <span>[root@localhost </span>MySQL<span>-5.0.20a]# chown -R </span>MySQL<span> /usr/local/</span>MySQL<span>/var </span> </li> <li class="alt"> <span>[root@localhost </span>MySQL<span>-5.0.20a]# chgrp -R </span>MySQL<span> /usr/local/</span>MySQL<span> </span> </li> <li> <span>[root@localhost </span>MySQL<span>-5.0.20a]# /usr/local/</span>MySQL<span>/bin/</span>MySQL<span>d_safe </span><span class="attribute">--user</span><span>=</span>MySQL<span> & </span> </li> <li class="alt"> <span>[root@localhost </span>MySQL<span>]# ./bin/</span>MySQL<span> -u root </span><span class="attribute">--socket</span><span>=/tmp/</span>MySQL<span>.sock </span> </li> </ol>
对于设置为服务只要把MySQL/share/MySQL/MySQL.server放到/etc/init.d/下改名为MySQL
<ol class="dp-xml"> <li class="alt"> <span>[root@localhost MySQL]# chmod 775 /etc/init.d/</span>MySQL<span> </span> </li> <li> <span>[root@localhost </span>MySQL<span>]# chkconfig --add </span>MySQL<span> </span> </li> <li class="alt">MySQL<span class="tag">></span><span> grant all privileges on mydb.* to 'admin'@'%' Identified by '123456'; </span> </li> <li><span>grant all privileges on mydb2.* to 'd_admin'@'%' Identified by '123456'; </span></li> <li class="alt"><span>GRANT ALL PRIVILEGES ON mydb2.* TO 'bodd'@'192.168.18.14' IDENTIFIED BY 'domainssl' REQUIRE SSL; </span></li> <li><span>flush PRIVILEGES; </span></li> </ol>
以上的相关内容就是对MySQL配置SSL的介绍,望你能有所收获。