How to configure SSL for MySQL

Source: Internet
Author: User
Tags localhost mysql

The following document describes how to configure SSL for MySQL. This document describes how to configure SSL for MySQL based on the actual application code, I hope you will be helpful in your future studies.

 
 
  1. [client]  
  2. ssl-ca=$DIR/cacert.pem  
  3. ssl-cert=$DIR/client-cert.pem  
  4. ssl-key=$DIR/client-key.pem  
  5. [MySQLd]  
  6. ssl-ca=$DIR/cacert.pem  
  7. ssl-cert=$DIR/server-cert.pem  
  8. ssl-key=$DIR/server-key.pem 

6. Test MySQL startup

 
 
  1. $ DIR is the path of the Option file my. cnf
  2. Shell> MySQLd -- defaults-file = $ DIR/my. cnf &
  3. Then invoke a client program using the same option file:
  4. Shell> MySQL -- defaults-file = $ DIR/my. cnf
  5. [Root @ localhost MySQL-5.0.20a] # chown-R root/usr/local/MySQL
  6. [Root @ localhost MySQL-5.0.20a] # chown-R MySQL/usr/local/MySQL/var
  7. [Root @ localhost MySQL-5.0.20a] # chgrp-R MySQL/usr/local/MySQL
  8. [Root @ localhost MySQL-5.0.20a] #/usr/local/MySQL/bin/MySQLd_safe -- user = MySQL &
  9. [Root @ localhost MySQL] #./bin/MySQL-u root -- socket =/tmp/MySQL. sock

For a service, you only need to put MySQL/share/MySQL. server under/etc/init. d/and change it to MySQL.

 
 
  1. [root@localhost MySQL]# chmod 775 /etc/init.d/MySQL  
  2. [root@localhost MySQL]# chkconfig --add MySQL  
  3. MySQL> grant all privileges on mydb.* to 'admin'@'%' Identified by '123456';  
  4. grant all privileges on mydb2.* to 'd_admin'@'%' Identified by '123456';  
  5. GRANT ALL PRIVILEGES ON mydb2.* TO 'bodd'@'192.168.18.14' IDENTIFIED BY 'domainssl' REQUIRE SSL;  
  6. flush PRIVILEGES;  

The above content is an introduction to configuring SSL for MySQL. I hope you will gain some benefits.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.