MySQL database security configuration practices

Source: Internet
Author: User

The following articles mainly introduce the actual operations of MySQL database security configuration. This article provides examples, of course, these instances are often used in the actual operations of the MySQL database security configuration, if you are a popular database. The following article will be meaningful to you.

Keywords: MySQL kernel Database Security Configuration User Authentication Module password restoration Stored Procedure writing MySQL database index

Summary:

Because MySQL is a multi-platform database, its default configuration should be considered to be applicable in various circumstances, so further security reinforcement should be carried out in our own use environment. As a MySQL System Administrator, we have the responsibility to maintain the data security and integrity of the MySQL database system.

If the user who starts the MySQL database is mysql, the following directories and files are safe. Pay attention to the data directory and the following attributes:

 
 
  1. shell>ls-l/usr/local/mysql  
  2. total40  
  3. drwxrwxr-x2rootroot4096Feb2720:07bin  
  4. drwxrwxr-x3rootroot4096Feb2720:07include  
  5. drwxrwxr-x2rootroot4096Feb2720:07info  
  6. drwxrwxr-x3rootroot4096Feb2720:07lib  
  7. drwxrwxr-x2rootroot4096Feb2720:07libexec  
  8. drwxrwxr-x3rootroot4096Feb2720:07man  
  9. drwxrwxr-x6rootroot4096Feb2720:07mysql-test  
  10. drwxrwxr-x3rootroot4096Feb2720:07share  
  11. drwxrwxr-x7rootroot4096Feb2720:07sql-bench  
  12. drwx------4mysqlmysql4096Feb2720:07var  
  13. shell>ls-l/usr/local/mysql/var  
  14. total8  
  15. drwx------2mysqlmysql4096Feb2720:08mysql  
  16. drwx------2mysqlmysql4096Feb2720:08test  
  17. shell>ls-l/usr/local/mysql/var/mysql  
  18. total104  
  19. -rw-------1mysqlmysql0Feb2720:08columns_priv.MYD  
  20. -rw-------1mysqlmysql1024Feb2720:08columns_priv.MYI  
  21. -rw-------1mysqlmysql8778Feb2720:08columns_priv.frm  
  22. -rw-------1mysqlmysql302Feb2720:08db.MYD  
  23. -rw-------1mysqlmysql3072Feb2720:08db.MYI  
  24. -rw-------1mysqlmysql8982Feb2720:08db.frm  
  25. -rw-------1mysqlmysql0Feb2720:08func.MYD  
  26. -rw-------1mysqlmysql1024Feb2720:08func.MYI  
  27. -rw-------1mysqlmysql8641Feb2720:08func.frm  
  28. -rw-------1mysqlmysql0Feb2720:08host.MYD  
  29. -rw-------1mysqlmysql1024Feb2720:08host.MYI  
  30. -rw-------1mysqlmysql8958Feb2720:08host.frm  
  31. -rw-------1mysqlmysql0Feb2720:08tables_priv.MYD  
  32. -rw-------1mysqlmysql1024Feb2720:08tables_priv.MYI  
  33. -rw-------1mysqlmysql8877Feb2720:08tables_priv.frm  
  34. -rw-------1mysqlmysql428Feb2720:08user.MYD  
  35. -rw-------1mysqlmysql2048Feb2720:08user.MYI  
  36. -rw-------1mysqlmysql9148Feb2720:08user.frm 

If the owner and attributes of these files are not the same, use the following two commands to correct them:

 
 
  1. shell>chown-Rmysql.mysql/usr/local/mysql/var  
  2. shell>chmod-Rgo-rwx/usr/local/mysql/var 

Starting remote services with the root user has always been a security taboo, because if the service program encounters problems, remote attackers are very likely to gain full control of the host. MySQL has made minor changes since version 3.23.15. After installation by default, the service should be started by mysql users, and root users are not allowed to start the service.

If you have to use the root user for startup, you must add the -- user = root parameter (./safe_mysqld -- user = root &). MySQL has the SQL statements of LOAD DATA INFILE and SELECT... INTO OUTFILE. If the root user starts the MySQL server, the MySQL database user has the write permission of the root user. However, MySQL still imposes some restrictions. For example, load data infile can only read globally readable files, and SELECT... into outfile cannot overwrite existing files.

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.