MySQL database security solution (3) _ MySQL-mysql tutorial

Source: Internet
Author: User
MySQL database security solution (3) tip: With the popularization of the network, more and more network-based applications are available. Network databases are one of them. One or several servers can provide services to many customers. this method brings a lot of convenience to people, but it also gives criminals a chance to take advantage of it. Because the data is transmitted over the network, it can be intercepted during the transmission process, or it can be accessed through a very convenient way.

OpenSSL has been added to the Windows version of MySQL. The preceding command is to check whether SSL is enabled for your MySQL instance.


Show variables like 'have _ openssl ';
+ --------------- + ------- +
| Variable_name | Value |
+ --------------- + ------- +
| Have_openssl | NO |
+ --------------- + ------- +
1 row in set (0.00 sec)


If NO is returned, you need to compile OpenSSL into your MySQL

Sometimes you may need to encrypt the user name and password for transmission. In this case, you can use the following GRANT command:


Grant all privileges on ssl_only_db. * to 'ABC' @ '%' identified by "password! "Require ssl;


You can also use the REQUIRE x509 option for SSL transmission:


Grant all privileges on ssl_only_db. * to 'ABC' @ '%' identified by "password! "REQUIRE x509;


You can also use require subject to specify a specific client certificate to access the database.


Grant all privileges on ssl_only_db. * to 'ABC' @ '%'
Identified by "password! "
Require subject "/C = US/ST = New York/L = Albany/O = Widgets Inc./CN = client-ray.
Example.com/emailAddress=raymond@example.com ";


Maybe you don't care about what customer licenses you are using, but only about your certificates. Then you can use require issuer to implement:


Grant all privileges on ssl_only_db. * to 'ABC' @ '%' identified by "password! "
Require issuer "/C = US/ST = New + 20 York/L = Albany/O = Widgets Inc./CN = cacert. example.
Com/emailAddress = admin@example.com ";


SSL can also be encrypted directly with a password. You can use require cipher to set the password.


Grant all privileges on ssl_only_db. * to 'ABC' @ '%' identified by "password! "
Require cipher "EDH-RSA-DES-CBC3-SHA ";


The GRANT command is used to set user permissions. The information is stored in the authorization table, which is the heart of the security system. The permissions of each user and client are saved in these tables. Correct operations on these tables will play a positive role in database security, and it will be very dangerous if you accidentally use these tables.

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.