Requirements for Automatic startup configuration in MySQL for security applications

Source: Internet
Author: User
Tags php database

This article shares with you the requirements of the security application MySQL for self-starting configuration. We all know that MySQL is favored by many people because of its open-source and practical features, of course, you must make full use of its features only when it is correctly and securely applied. The following articles describe its correct usage.

Note that a new account is required for the PHP database, and the database permission settings are available for the database, for example, FILE, GRANT, ACTER, show database, RELOAD, SHUTDOWN, PROCESS, and SUPER.

Example of self-starting script:

 
 
  1. #!/bin/sh  
  2. CHROOT_MYSQL=/chroot/mysql   
  3. SOCKET=/tmp/mysql.sock  
  4. MYSQLD=/usr/local/mysql/libexec/mysqld  
  5. PIDFILE=/usr/local/mysql/var/`hostname`.pid  
  6. CHROOTUID=/usr/bin/chrootuid  
  7. echo -n " mysql"  
  8. case "$1" in  
  9. start)  
  10. rm -rf ${SOCKET}  
  11. nohup ${CHROOTUID} ${CHROOT_MYSQL} mysql ${MYSQLD} >/dev/null 2>&1 &  
  12. sleep 5 && ln ${CHROOT_MYSQL}/${SOCKET} ${SOCKET}  
  13. ;;  
  14. stop)  
  15. kill `cat ${CHROOT_MYSQL}/${PIDFILE}`  
  16. rm -rf ${CHROOT_MYSQL}/${SOCKET}  
  17. ;;  
  18. *)  
  19. echo ""  
  20. echo "Usage: `basename $0` {start|stop}" >&2  
  21. exit 64  
  22. ;;  
  23. esac  
  24. exit 0 

The security application MySQL requires that the file of the self-starting configuration be located in/etc/rc. d/init. d, named mysqld. Be sure to execute it.

 
 
  1. #chmod +x /etc/rc.d/init.d/mysqld  
  2. #ln -s /etc/rc.d/init.d/mysql /etc/rc3.d/S90mysql  
  3. #ln -s /etc/rc.d/init.d/mysql /etc/rc0.d/K20mysql 

Although we cannot achieve 100% of the security, these measures can protect our system more securely.

The above content is an introduction to the requirements of the security application MySQL for self-starting configuration. 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.